Copy link to clipboard
Copied
I am new to expressions and am trying to rotate multiple shape layers. So far I keyframed the top layer to rotate around the z axis 360 degrees. There is a slider on the first layer that controls the time offset and an index/value at time expression on the layer below. The problem is that every layer rotates 360 degrees and I want each layer below when duplicated to rotate 22.5 degrees less and all ease in and out. The expression I used is:
timeoffset = thisComp.layer("top card").effect("Slider Control")("Slider");
thisComp.layer("top card").transform.rotation.valueAtTime(time - ((index - 1) * timeoffset))
layer 1 360
layer 2 337.5
layer 3 315 etc.
I would appreciate some suggestions. Thank you.
When the animation is done it should look close to below
I don't want it to continue on like below
1 Correct answer
If they all start at the same angle and position, then they can't all possibly rotate 360 to end up the way you've depicted - all except one must rotate more than 360 degrees.
Take a look at the AEP in the download link. Expressions are below. The screen grab below show the props used. Number
of Shapes should be obvious for its use and this number should ideally be set prior to duplicating the Shape Layers until you reach the number set here.
Total Rotation sets how much you want the layers to
...Copy link to clipboard
Copied
Why make it so complicated? Could be as easy as tying everything to a "Completion" slider:
mCom=thisComp.layer("XYZ").effect("Completion")("Slider");
mAng=index*22.5;
mPer=linear(mAng,0,360);
mOut=linear(mCom,0,100,0,mPer);
Mylenium
Copy link to clipboard
Copied
If they all start at the same angle and position, then they can't all possibly rotate 360 to end up the way you've depicted - all except one must rotate more than 360 degrees.
Take a look at the AEP in the download link. Expressions are below. The screen grab below show the props used. Number
of Shapes should be obvious for its use and this number should ideally be set prior to duplicating the Shape Layers until you reach the number set here.
Total Rotation sets how much you want the layers to be spread out in terms of a circle. 360 means all the layers will be rotated around a complete circle - at least that's the logic.
Use the Start Angle to set which angle you want the rotation to begin.
Scalar is a Slider that contains two keyframes which drives the animation.
http://www.broadcastGEMs.com/mediaStreamer/bGEMs_ScalarRotation_Sequential_Engine_01.zip
// declare how much along a circle, the shape layers will be placed
tR=thisComp.layer("Controller").effect("Total Rotation")(1);
// declare number of shapes to use
nShapes=thisComp.layer("Controller").effect("Number of Shapes")(1);
// get diferrence of rotation value between each successive shape layer
rot=tR/nShapes;
// declare a scalar using layer index;
IndexScalar=index*rot;
// declare where to get keyframes values from, for use in interpolation method
Scalar=thisComp.layer("Controller").effect("Scalar")(1);
// get start value which uses a Slider for added customization
KF01=thisComp.layer("Controller").effect("StartAngle")(1)+90;
// declare value for end value using Index as a scalar
KF02=360+(IndexScalar);
// use interpolation method to drive the animation
linear(Scalar,0,360,KF01,KF02)
Copy link to clipboard
Copied
You can do what you want to do with a single shape on a single shape by simply adding a repeater. This is everything I did to the layer. The rotation was calculated by dividing 360 by the number of copies (18) that I wanted in the graphic.
Copy link to clipboard
Copied
You won't have much control over an animation with Repeated Shapes. Hence, most folks use the Repeater to pose their shapes and then use Shape Repeater Baker to get each repeated shape onto its own layer.

