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

Opposing rotation expression

Explorer ,
Jul 22, 2024 Jul 22, 2024

Hello I am trying to create a basic butterfly wing animation (top down. And I just want to add an expression to make the left wing rotate in the opposite direction.  and the shadows to basically do the same.

 

I am currently using the following expression. And it's not working. Does anyone have any suggestions?

thisComp.layer("Right Wing").transform.yRotation;

//value *= -1;

TOPICS
Expressions
661
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 Expert ,
Jul 22, 2024 Jul 22, 2024

Subtract the rotation of the master wing from the rotation value of the other wing. Put the animated wing layer above the second wing, and this expression will do it.

ref = thisComp.layer(index - 1).rotation;
value - ref

 Or you could put the name of the animated wing in the first line like this: ref = thisComp.layer("Right Wing").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
Explorer ,
Jul 22, 2024 Jul 22, 2024

Thanks so much for the post. Maybe I am doing it wrong, but I am not able to get it to work. I tried both ways. But unsuccessful.

 

Screenshot 2024-07-22 at 11.09.59 PM.png

 

 

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 Expert ,
Jul 22, 2024 Jul 22, 2024

When you apply the expression to a 3D layer, you need to make the ref the specific value for that layer. You are using Y, so the expression should be this:

ref = thisComp.layer(index - 1).transform.yRotation;
value - ref

That should fix the problem. If the right wing is above the left, the expression subtracts the Y rotation value from the left Wing layer's Y 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
Explorer ,
Jul 23, 2024 Jul 23, 2024
LATEST

Got it! Thank you so much! It's working! Really appreciate it!

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