Activity › Forums › Adobe After Effects Expressions › valueAtTime and yRotation
-
valueAtTime and yRotation
Posted by Jeff Mcbride on May 18, 2007 at 2:07 pmI’m trying to rotate a bunch of objects around the Y-axis with a 2 frame delay from each other. What I’ve tried is keyframing a master object to do the yRot and setting up another object with this expression:
delay = 2; //number of frames to delay
d = delay*thisComp.frameDuration*(index – 1);
thisComp.layer(“2_17”).transform.yRotation.valueAtTime(time – d)I think I’ve got things setup incorrectly but not sure how. I think the code is stack order dependent? Thanks for the help!
Filip Vandueren replied 19 years ago 4 Members · 8 Replies -
8 Replies
-
Dan Ebberts
May 18, 2007 at 2:17 pmYour expression assumes that your first follower layer is layer 2 in the stacking order, the second follower is layer 3, and so on. How did you want to set it up?
Dan
-
Jeff Mcbride
May 18, 2007 at 2:48 pmMy setup right now is this:
Layer 1 – No expressions, Keyframed yRot changes
Layers 2+ – Expression on yRot property:delay = 2; //number of frames to delay
d = delay*thisComp.frameDuration*(index – 1);
thisComp.layer(“Layer 1”).transform.yRotation.valueAtTime(time – d)It doesn’t change the yRot of any of the secondary layers based on the keyframes set in Layer 1. Is this the correct setup?
-
Dan Ebberts
May 18, 2007 at 2:58 pmThe only problem I see is that I think it should be rotationY instead of yRotation.
Dan
-
Filip Vandueren
May 18, 2007 at 3:10 pmI’ve tested and found no problems or errors.
What version af after effects are you using.
I think the ‘transform’ property was introduced in a later version, you can leave it out like this:
delay = 20; //number of frames to delay
d = delay*thisComp.frameDuration*(index – 1);
thisComp.layer(“Layer 1”).yRotation.valueAtTime(time – d);The only other thing I can think of is that there is another layer called “Layer 1” that’s not animated…
-
Jeff Mcbride
May 18, 2007 at 3:25 pmIf I switch to RotationY, AE automatically switched back to yRotation.
If I drop the transform property I get the error:
Class ‘Layer’ has no property of method named ‘yRotation’ Expression disabled.
So neither of those suggestions seem to work, unless I have something else screwed up.
I’m running 7.0 Pro. Thanks again for all the help!
-
Mike Clasby
May 18, 2007 at 4:20 pmFilip’s works for me on AE 6.5, try this, just keyframe orientation (Y Orientation for yours) then you don’t have to worry about which rotation you’re using:
delay = 20; //number of frames to delay
d = delay*thisComp.frameDuration*(index – 1);
thisComp.layer(1).orientation.valueAtTime(time – d)The top layer controls all below that have this expression.
-
Jeff Mcbride
May 18, 2007 at 4:30 pmWell I figured out my problem. The control layer wasn’t the first layer in the stack. There were layers above which I didn’t realize would make a difference, does the (index-1) tag always reference the top most layer? Thanks for all the help!
-
Filip Vandueren
May 18, 2007 at 4:44 pm([LGABoarder] “does the (index-1) tag always reference the top most layer”
No,
the index-1 in this script has nothing to do with which layer you’re copying the value from.
delay = 20; //number of frames to delay
d = delay*thisComp.frameDuration*(index – 1);
thisComp.layer(“Layer 1”).yRotation.valueAtTime(time – d);You’re reading the value of yrotation from layer “Layer 1”, at time d
(index-1) is used to calculate the time, which for each consecutive layer should be a bit earlier.
normally you would want the time between the original and the first ‘echo’ to be the same as between consecutive echoes, so you should alter the (index-1) part to reflect the actual index of the first echo-layer.
ie.:
if the first echo is layer Nr. 5 (it has index 5)
you should use index-4.
Reply to this Discussion! Login or Sign Up