Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions “DVD screeensaver” change color when bouncing off the wall

  • “DVD screeensaver” change color when bouncing off the wall

    Posted by Peter Toth on January 6, 2020 at 7:13 am

    Hi everyone,

    I’m trying to do a “DVD screensaver” via AE expressions. (Like this) 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<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]+[marginw,marginh]

    Peter Toth replied 6 years, 7 months ago 2 Members · 2 Replies
  • 2 Replies
  • Andrei Popa

    January 6, 2020 at 6:11 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.

  • Peter Toth

    January 6, 2020 at 7:17 pm

    Thank You ☺ Works like a charm

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