ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

"DVD screeensaver" change color when bouncing off the wall

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Peter Toth
"DVD screeensaver" change color when bouncing off the wall
on Jan 6, 2020 at 7:13:55 am

Hi everyone,

I'm trying to do a "DVD screensaver" via AE expressions. (



) I'm at the point when the bouncing works perfectly, but I don't know how to achieve the "when bouncing change the color" thing. Actually it should pick a random value for Colorize Hue - I think - . It should work via expression, not by keyframes, because I want it to work with any comp size, and length.

Can anybody help me? Thanks ☺
Here is the position bouncing part below. The margins has been calculated from the DVD logo.

hSpeed= 222;
vSpeed= 200;

marginh = 76;
marginw = 175;

cw=thisComp.width - marginw*2;
ch=thisComp.height -marginh*2;
x = value[0] - marginw + time*hSpeed;
y = value[1] - marginh + time*vSpeed;
x = x&lt;0 ? -x : x;
x%=2*cw;
x = x>cw ? (2*cw)-x : x;

y = y&lt;0 ? -y : y;
y%=2*ch;
y = y>ch ? (2*ch)-y : y;

[x,y]+[marginw,marginh]


Return to posts index

Andrei Popa
Re: "DVD screeensaver" change color when bouncing off the wall
on Jan 6, 2020 at 6:11:28 pm

Add a fill property with this expression to its color.


startX = position.valueAtTime(0)[0];
startY = position.valueAtTime(0)[1];
hSpeed= 222;
vSpeed= 200;

marginh = 76;
marginw = 175;

cw=thisComp.width - marginw*2;
ch=thisComp.height -marginh*2;
x = startX - marginw + time*hSpeed;
y = startY - marginh + time*vSpeed;
s = Math.floor(x/cw)+Math.floor(y/ch);
seedRandom(s,true);
random([1,1,1]) + [0,0,0,1]


Andrei
My Envato portfolio.


Return to posts index

Peter Toth
Re: "DVD screeensaver" change color when bouncing off the wall
on Jan 6, 2020 at 7:17:28 pm

Thank You ☺ Works like a charm


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]