Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions pong -ish motion

  • Posted by Gabriel Regalbuto on July 20, 2005 at 6:29 pm

    I am trying to get a logo to bounce around the screen randomly for a few minutes and don’t want to keyframe. I’ve Dan Ebberts’ excellent expressions tutorials, but still don’t have the chops to make it happen. Can someone point me in the right direction?

    Filip Vandueren replied 20 years, 9 months ago 2 Members · 2 Replies
  • 2 Replies
  • Filip Vandueren

    July 20, 2005 at 11:54 pm

    Hi,

    this is a bit different from Dan’s example wich uses random directions I believe.
    A true-er pong motion if you will: ingoing angle is always the same as outgoing angle. Like those really old windows screensavers.
    change the values in the first three lines.

    apply expression to position-param:

    box=[20,20,300,220]; // box you want to stay in [x1,y1,x2,y2]
    motion=[312,123]; // motion-vector in pixels per sond [x,y]
    startpos=[160,120]; // startposition

    // calculations:
    w=box[2]-box[0]; h=box[3]-box[1]; corner=[box[0],box[1]];
    delta=motion*time; pos=startpos+delta-corner;
    xx=pos[0]%(w*2); yy=pos[1]%(h*2);

    corner+[xx

  • Filip Vandueren

    July 21, 2005 at 2:49 pm

    something went wrong, the last line was truncated:


    box=[20,20,300,220]; // box you want to stay in [x1,y1,x2,y2]
    motion=[312,123]; // motion-vector in pixels per sond [x,y]
    startpos=[160,120]; // startposition

    // calculations:
    w=box[2]-box[0]; h=box[3]-box[1]; corner=[box[0],box[1]];
    delta=motion*time; pos=startpos+delta-corner;
    xx=pos[0]%(w*2); yy=pos[1]%(h*2);

    corner+[xx,yy]

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