Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions y position within a range of two values

  • Dan Ebberts

    August 4, 2012 at 4:26 pm

    You didn’t describe what kind of up and down motion you’re looking for, but this will oscillate a layer’s y value between 300 and 700:

    maxY = 700;
    minY = 300;
    f = 1;

    y = linear(Math.cos(time*f*Math.PI*2),-1,1,maxY,minY);
    [value[0],y]

    Dan

  • Aqeel Arruhaili

    August 4, 2012 at 6:50 pm

    wonderful but how about if i want to use wiggle with that and how could i make it slower

  • Dan Ebberts

    August 4, 2012 at 7:03 pm

    This should work:

    maxY = 700;
    minY = 300;
    f = .5;

    y = linear((wiggle(f,1)-value)[1],-1,1,maxY,minY);
    [value[0],y]

    Modify f to adjust the speed.

    Dan

  • Aqeel Arruhaili

    August 4, 2012 at 7:39 pm

    Thank you so much

  • Aqeel Arruhaili

    August 4, 2012 at 8:11 pm

    what if i want to show the wiggled value in a text layer but with a different range between 40 to (-90).

  • Dan Ebberts

    August 4, 2012 at 9:17 pm

    I’m not sure if it does what you’re asking, but try this:

    maxY = 40;
    minY = -90;
    f = .5;

    p = transform.position;
    y = linear((p.wiggle(f,1)-p.value)[1],-1,1,maxY,minY);

    Dan

  • Aqeel Arruhaili

    August 4, 2012 at 11:42 pm

    If I have an object that wiggles up and down using your expression within 300 and 700 and I wanted to use the y position in a text layer to display a changing number on screen but i need it to be within the range of 40 to -90 instead of 300 to 700.

  • Dan Ebberts

    August 4, 2012 at 11:48 pm

    Try this:

    y = thisComp.layer(“wiggle layer”).transform.position[1];
    linear(y,300,700,40,-90)

    Dan

  • Aqeel Arruhaili

    August 5, 2012 at 1:28 am

    i used the expression but nothing changed. the same numbers between 300 and 700 appears on screen.

  • Aqeel Arruhaili

    August 5, 2012 at 1:32 am

    Oh sorry it was my fault…it works wonderfully…thanks alot

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