Creative Communities of the World Forums

The peer to peer support community for media production professionals.

  • Posted by Marten Kopp on March 21, 2011 at 11:09 am

    Hi guys,

    I am trying to make a animation based on the old ping-pong game. I want to use an expression that sent the cube up and down.

    The cube moves from left to right, back to the left and again to the right but at that point it doesn’t remember it is supposed to bounce back again.

    Anyone know some solutions?

    sp = 500;
    xPos = time *sp;

    if (xPos >thisComp.width){
    xPos = time * -sp+(thisComp.width*2);}

    if (xPos <(thisComp.width-thisComp.width)){ xPos = time * sp-+(thisComp.width*2);} [xPos,0]

    Dan Ebberts replied 15 years, 1 month ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    March 21, 2011 at 4:19 pm

    Like this, I think:

    sp = 500;

    totalDist = time *sp;
    numCompleteTrips = Math.floor(totalDist/thisComp.width);
    thisTrip = totalDist%thisComp.width;
    goingLeft = numCompleteTrips%2;
    [goingLeft ? thisComp.width – thisTrip : thisTrip, value[1]]g

    Dan

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