4 Replies Latest reply on Sep 5, 2016 8:00 PM by Emrecan51403863

    Sync with looped background



      i am making 2d side view car animation.i have a looped background composition.Sometimes my car should overcome to obstacles on the road.and i cannot make a true sync between looped road compositions and objects on the road.i cannot put objetcs into looped compositon you know.how can i provide sync them together?

      the second question is you know have looped background and looped wheels if i want to stop animation i am using checkbox expression but when i want to start that keep the composition rolling but it starts at first frame.How can i fix this?

        • 1. Re: Sync with looped background
          Rick Gerard Adobe Community Professional & MVP

          Without seeing your comp and determining how you are setting things up it's hard to tell but the easiest way to sync the movement of a layer to a looping background is to extract the velocity information from the looping footage with an expression and use that to drive the motion of the obstacle. The complexity of the expression increases if you are using 3D layers. In some cases it may be easier to just take a look at the speed graph of the loop and replicate that speed with keyframes in the main comp for the obstacle. The most efficient option might be to just keyframe things manually.


          Take a look at this comp for a possible solution.

          1 person found this helpful
          • 2. Re: Sync with looped background
            Emrecan51403863 Level 1

            Here's my example project file. Adobe Creative Cloud

            i couldn't adapt velocity expression to my vector files well

            • 3. Re: Sync with looped background
              Rick Gerard Adobe Community Professional & MVP

              Try this. Add a null to the comp and name it something like Speed Null 1. Add this expression to the position property of the null:

              y = value[1];

              v = comp("BackG.ai Comp 1").layer("BackG.ai").effect("Offset")("Shift Center To").velocityAtTime(.1);

              s = (time - inPoint) * v * 2;

              x = value[0] + s;


              [x[0], y]

              Here's what the expression does. Line one grabs the current Y value for the null. Line 2 takes the velocity of the offset in the background comp. More on this later. Line 3 starts counting time at the in point of the null layer and then time is multiplied by the velocity of the offset in pixels per second. Because it is an offset velocity and not a position velocity you have to multiply that number by 2.. Line 4 adds the "s" value from line 3 to the X position value of the null. Finally you declare the array for position which uses the calculated value for X based on the velocity of the offset and the current value of y.


              Now you parent one of the obstacle layers to the null, set the in point for the obstacle layer and the null to the point in the timeline where you want the obstacle to appear and then move down the timeline until it runs into the truck. At that point you split the layer (Ctrl/Cmnd + Shift + d) and remove the parenting from the top copy. You can then animate position and rotation to simulate the collision.


              Duplicate the null and attach follow the procedure with your other obstacles.


              One more comment on your comp. I noticed that the speed of your wheels did not match the speed of the background. This is also very easy to fix because you know the velocity in pixels per second and if you multiply the diameter of the wheel by PI you can calculate the circumference of the wheel. Simple math makes the wheels rotate at the right speed. The current keyframes and loopOut() expression can be replaced with this expression:

              v = comp("BackG.ai Comp 1").layer("BackG.ai").effect("Offset")("Shift Center To").velocityAtTime(.1);

              s = time * v[0];

              c = Math.PI*width;

              s * c

              You should be able to figure thins out from there. Here's your comp with the changes made to the barrel layer. Enjoy....

              • 4. Re: Sync with looped background
                Emrecan51403863 Level 1

                You explain everything clearly.It's basic physics.

                Find the velocity of comp and get it that value. ---in second line

                Find the time then multiply with velocity because Distance (s)  = velocity (v) x time (t) and we calculated how much pixels should null object move in x position (then multply by 2 because of offset effect-) ---3rd line

                Add that value to moving null object in x position and find new x position ---4th line

                Assign new x and y value as an array for possition of null object.


                And the 2nd one is a basic circle geometry formula


                Thank you for your kind help and you send my project back with solved the problem.You're best!!!