Copy link to clipboard
Copied
I have this code for Position offset time, but, how to turn it for rotation offset time? I have tried to change the "p" for "r" and "position" to "rotation" but still not working...
offset = -.5;
p = thisComp.layer("My Animated Layer");
t = time + offset;
p.position.valueAtTime(t);
Thanks
Use my code exactly, but replace the name of the layer in the quotations-- so, your second example.
This line: targetLayer = thisComp.layer("Target Layer Name"); establishes "I want to look at this layer, called Target Layer Name."
Then, later on, we say "from Target Layer Name, let's look at it's transform group, and within there let's look at z-rotation" -- targetLayer.transform.zRotation
And then we get it's value, from a little before the current value.
You could rewrite it so that the zRotation
...Copy link to clipboard
Copied
When you say it's not working, what specifically is not working? Are you getting any kind of error? The code below should work fine, though you'll need to replace "Target Layer Name" with the target layer name
offset = -.5;
targetLayer = thisComp.layer("Target Layer Name");
t = time + offset;
targetLayer.rotation.valueAtTime(t);
Copy link to clipboard
Copied
This works for Z Rotation? I mean, the null which I want to write the expresion in 3D (also the Null I want to follow to its Z Rotation)
Copy link to clipboard
Copied
For Z Rotation, just replace 'rotation' with 'transform.zRotation' -- so, you'd get:
offset = -.5;
targetLayer = thisComp.layer("Target Layer Name");
t = time + offset;
targetLayer.transform.zRotation.valueAtTime(t);
Copy link to clipboard
Copied
And for the second line of your code:
targetLayer = thisComp.layer("Target Layer Name");
I must maintain the entire "linked"/"parent", I mean all this:
targetLayer = thisComp.layer("Cam Control").transform.zRotation;
Or In only muts write the title/name of the Target Layer?
targetLayer = thisComp.layer("Cam Control");
Copy link to clipboard
Copied
Use my code exactly, but replace the name of the layer in the quotations-- so, your second example.
This line: targetLayer = thisComp.layer("Target Layer Name"); establishes "I want to look at this layer, called Target Layer Name."
Then, later on, we say "from Target Layer Name, let's look at it's transform group, and within there let's look at z-rotation" -- targetLayer.transform.zRotation
And then we get it's value, from a little before the current value.
You could rewrite it so that the zRotation is in targetLayer, and that'd look like this:
offset = -.5;
targetLayerRotation = thisComp.layer("Target Layer Name").transform.zRotation;
t = time + offset;
targetLayerRotation.valueAtTime(t);
So we're doing the exact same thing, we're just doing it in a different order-- but at the very end, we're still getting valueAtTime(t) from the layer's zRotation.
Copy link to clipboard
Copied
Zlovatt you are a genius!! you're great!! Thank you very much!!
Both versions works:
offset = -.5;
targetLayer = thisComp.layer("Cam Control");
t = time + offset;
targetLayer.transform.zRotation.valueAtTime(t);
offset = -.5;
targetLayerRotation = thisComp.layer("Cam Control").transform.zRotation;
t = time + offset;
targetLayerRotation.valueAtTime(t);
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more