Activity › Forums › Adobe After Effects Expressions › y position within a range of two values
-
y position within a range of two values
Posted by Aqeel Arruhaili on August 4, 2012 at 10:23 amHow can i make an object moves up and down only without changing x position within a range of two values for example from 300 to 700. thanks
Aqeel Arruhaili replied 13 years, 9 months ago 2 Members · 10 Replies -
10 Replies
-
Dan Ebberts
August 4, 2012 at 4:26 pmYou 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 pmwonderful 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 pmThis 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 8:11 pmwhat 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 pmI’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 pmIf 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 pmTry this:
y = thisComp.layer(“wiggle layer”).transform.position[1];
linear(y,300,700,40,-90)Dan
-
Aqeel Arruhaili
August 5, 2012 at 1:28 ami used the expression but nothing changed. the same numbers between 300 and 700 appears on screen.
Reply to this Discussion! Login or Sign Up