Creative Communities of the World Forums

The peer to peer support community for media production professionals.

  • Posted by Lucia Bastenhof on December 1, 2008 at 4:19 am

    Hi ! 🙂

    Here’s something my brain can’t understand. For what I had understood, the linear function allows us to replace a range of values by another. Right ?

    Here’s the case.
    Here are two lines rotating from the center of a circle. Visually, they are similar : their position, their rotation are visually similar, they appear at the same place, the same angle.
    But their movements are not built the same way :
    – The line A’s movement is controlled by a slider, ranging from 0 to 800.
    – The line B’s movement is controlled by its rotation parameter, ranging from 0 to -360.

    I want these 2 ranges to be replaced by a range from 90 to -270.
    I think : “Yeah, no matter what my values are, the linear function is going to give me the same result.”
    I thought.

    – For the line A, I wrote :
    linear(thisComp.layer(“scanner”).effect(“Parameter”)(“Cursor”),0,800,90,-270)
    – For the line B, I wrote :
    linear(comp(“Aiguille PC”).layer(“Aiguille”).transform.rotation,0,-360,90,-270)

    And here are the values they give :
    – Time1 : A= -30 ; B= -150
    – Time2 : A= -270 ; B= 0
    – Time3 : A= -193,2 ; B= 13,2

    !!!HOW is this possible ???!!!
    Why doesn’t the linear functions return the same values ??
    And I guess there is a link between the returned values, but I can’t figure it out.

    Do you understand what’s happening ?

    Thanks for your help !

    Lucia Bastenhof replied 17 years, 5 months ago 2 Members · 6 Replies
  • 6 Replies
  • Dan Ebberts

    December 1, 2008 at 6:00 am

    The second parameter to linear() needs to be less than the third parameter.

    Try changing your second expression to this:

    linear(comp(“Aiguille PC”).layer(“Aiguille”).transform.rotation,-360,0,-270,90)

    Dan

  • Lucia Bastenhof

    December 3, 2008 at 4:12 am

    I don’t understand quite well. You write : “The second parameter to linear() needs to be less than the third parameter. “. But 0 is more than -270 ?
    Did you want to say : “The first parameter to linear() needs to be less than the second parameter.” ?

    Anyway, I tried it, but the returned values remain different :
    – time1 : A=-30 , B=-150
    – time2 : A=-270 , B=90
    – time3 : A=-193,2 , B=13,2
    I learn the order is important, time2 is different, but there remain 2 deep questions :
    1/ Why are the returned values different ?
    2/ The result is half good, half wrong. Basically, the expression is written on the opacity parameter of a layer-object, and this object appears now, indeed, when encountering the scanner-line.
    But its behavior remains strange : its opacity is on and off like with a wiggle. ?

    For full information, here’s the entire expression :

    ===========================
    sldval = degreesToRadians(180-linear(comp(“Aiguille PC”).layer(“Aiguille”).transform.rotation,-360, 0,-270, 90));
    object = transform.position;

    x0 = thisComp.layer(“grid”).transform.anchorPoint[0];
    y0 = thisComp.layer(“grid”).transform.anchorPoint[1];

    rayon = length(thisComp.layer(“grid”).transform.anchorPoint,object);

    xA = x0 + rayon * Math.cos(-sldval );
    yA = y0 + rayon * Math.sin(-sldval );

    aiguille = [xA,yA];

    dist = length(aiguille,object);

    if((dist > 0) && (dist < 10)){ 100; }else{ 0; } ================================== The source parameter is coming from another comp ("linear(comp(“Aiguille PC”).layer…..) but I don’t think that it’s the cause of this behavior.

    Do you have an answer to one of those 2 questions ?

    THANKS !! 🙂

  • Dan Ebberts

    December 3, 2008 at 5:38 am

    It’s still not clear to me what you’re trying to do, but the way you have it set up, as comp(“Aiguille PC”).layer(“Aiguille”).transform.rotation varies from 180 to 540, sldval will go from 90 to -270. Is that not what you want?

    Dan

  • Lucia Bastenhof

    December 3, 2008 at 1:35 pm

    Hi,

    I made a little rendering so that you can have a glance at it.
    Here it is : https://fr.youtube.com/watch?v=IJWqxMeX5ls

    I followed a tutorial by Maltaannon, to make a radar, and an object that becomes visible only when encountering the radar.
    I then tried to make my own one, and to make it really like I wanted, I needed to make the radar line by a different way, in a precomp.

    The line A I talked about is the tutorial one, and it works perfectly of course, that is to say the object appears when asked.
    The line B is my own radar line, and I try to adapt the expression.

    It seems to be more difficult than I thought, but if I learn something, that’s OK. That’s why I’m still trying to solve it.

    As you can see in the video, the object remains visible quite a long time, and it reacts like with a wiggle on the opacity. But what’s good now (with the first changes you suggested) is that it appears at the right moments, when encountering the radar.

    With the values you suggested in your last message, I made some attempts, changing :
    – the rotation values (at first,0 -> -360) to 540 -> 180, and to 360 -> 0 ;
    – the values of the linear in the expression following the new ones, trying 90,-270 and -270, 90.
    But the results are worse : the same wiggling reaction, and it appears only one time instead of 3 (the 2nd time only).

    Do you understand what’s wrong with all that ?

    Thank you.

  • Dan Ebberts

    December 3, 2008 at 2:32 pm

    I don’t, but my hunch would be that it’s something in the other part of the expression. My suggestion would be to apply the expression to a slider, turn on the graph editor, comment different portions of the expression in and out until you find the piece that’s introducing the wiggle.

    Dan

  • Lucia Bastenhof

    December 3, 2008 at 6:59 pm

    I’ll try some tweakings tomorrow. But what’s strange is that the rest of the expression works perfectly when applied with the first linear…

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy