Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Rotation offset time

Community Beginner ,
Aug 19, 2015 Aug 19, 2015

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

TOPICS
Expressions
1.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Contributor , Aug 20, 2015 Aug 20, 2015

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

...
Translate
Contributor ,
Aug 19, 2015 Aug 19, 2015

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);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 20, 2015 Aug 20, 2015

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)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 20, 2015 Aug 20, 2015

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);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 20, 2015 Aug 20, 2015

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");

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 20, 2015 Aug 20, 2015

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 20, 2015 Aug 20, 2015
LATEST

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);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines