Activity › Forums › Adobe After Effects Expressions › DVD Logo Style Bouncing Layer Expression
-
DVD Logo Style Bouncing Layer Expression
Shai Ezra replied 6 years, 9 months ago 10 Members · 18 Replies
-
Sebastian Smith
May 29, 2019 at 10:04 pmhey filip,using this expression results in an error. do you know whats wrong with it?
-
Filip Vandueren
May 29, 2019 at 11:08 pmSee my post just below it, The forum scramblers Some of the “less than” symbols
-
Sebastian Smith
May 30, 2019 at 12:14 amokay it fixed it but the thing im using doesnt have the same dimensions on x and y,so kinda goes a bit over the border on the left and the ride side of the comp. how would i fix that/control that?
-
Filip Vandueren
May 30, 2019 at 10:15 pmYou would need 2 separate margin-variables
H_margin=150;
V_margin=80;And then use those where needed.
-
Filip Vandueren
June 3, 2019 at 8:34 pmThe best way to loop it is to find hSpeed and vSpeed such that they eventually wind up at the same place again.
Here’s the expression changed so you can set it to loop at a certain time and a certain number of H en V bounces
hMargin= 100; // how far the anchorpoint of the layer has to stay from the edges of the comp.
vMargin= 50cw=thisComp.width - hMargin*2;
ch=thisComp.height -vMargin*2;loopTime = 5; // seconds
// next two should be integers, preferably not divisible by each other,
// for high numbers I recommend prime numbers
hLoops = 3;
vLoops = 4;t=time%loopTime;
hSpeed = hLoops*2*cw/loopTime;
vSpeed = vLoops*2*ch/loopTime;// calculate the layer moving at a constant speed
x = value[0] - hMargin + t*hSpeed;
y = value[1] - vMargin + t*vSpeed;// keep the layer in bounds
x = x<0 ? -x : x;
x%=2*cw;
x = x>cw ? (2*cw)-x : x;y = y<0 ? -y : y;
y%=2*ch;
y = y>ch ? (2*ch)-y : y;[x,y]+[hMargin,vMargin]
-
Shai Ezra
August 4, 2019 at 5:40 pmThank you very much! It worked perfectly!
I don’t understand expressions too well but copy-paste this to the position expression worked.
I also got the errors… I located the problematic lines in the expression and just deleted them, the effect didn’t change. You could even change the speed by changing the values. more luck than brains haha
once again thank you my friend (:
Reply to this Discussion! Login or Sign Up