Bouncing DVD Logo: How do I change the shape color when it changes direction?
I am new to this forum and to after effects expressions. I thought an easy project to try using expressions on is the old bouncing DVD logo. Boy was I wrong. I learned to make the bouncing dvd logo expression from Dan Ebberts here: https://forums.creativecow.net/thread/227/1416
But what I am still missing is making the color of the shape layer change color every time it hits a wall and changes direction. I figured the best way would be to use the original expression and make the fill layer change color when the shape velocity hits 0 and changes direction, but I don't know how expression math works.
Is there a way to do this? Please let me know!
(also if anyone knows a website or book to learn basic expressions please point me in the right direction)
What you're looking for in the way of color change seems a little vague. Maybe you could describe it a little better.
Thanks for responding. The best way for me to describe the color change is this:
Every time the logo hits a wall it's color changes to the next preselected color.
OR (if it's easier)
Every time the logo hits a wall it's color changes randomly to 1 of 6 preselected colors.
Here's an example of what I'm describing.
OK. So the trick is that because two expressions (position and color) will depend on the same random calculations, you need to move those outside the position expression. Add a Point Control named "pos" with this expression:
left = 100;
top = 100;
right = thisComp.width -100;
bottom = thisComp.height -100;
minX = left;
maxX = right;
minY = top + 20;
maxY = bottom - 20;
Add a slider named "quadrent" with this expression:
Add a slider named "angle" with this expression:
minR = 5;
maxR = 85;
quadrent = effect("quadrent")("Slider");
random(minR,maxR) + quadrent;
and a slider named "spd" with this expression:
minSpeed = 200; //pixels per second
maxSpeed = 200;
Then modify the Position expression to this:
Finally, add A Fill effect with this expression for color: