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

Flip position values

Explorer ,
Sep 16, 2023 Sep 16, 2023

Hi!

I wonder is it possible. I have an animation of an object that moves down on X axis. I want to flip the values so they move exactly the same but upwards starting from the same value. See attachment.

flip.png

TOPICS
Expressions
1.2K
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 ,
Sep 16, 2023 Sep 16, 2023

The X-axis is left and right, and the Y-axis is up and down. I'm not exactly sure what you are trying to accomplish.

 

That looks like a screenshot of the graph editor with separated dimensions. The movement of the layer is originally right, then left, then right again. I don't know what the vertical movement looks like.

 

You can flip the graph upside down and change the X movement so that the movement starts where it now ends and ends where it originally started by selecting all keyframes and then choosing Animation/Keyframe Assistant/Time Reverse Keyframes. The problem with separated dimensions is that you will completely change the actual path of the layer by only reversing the X position keyframes. You may want to turn off separate dimensions. Changing the motion path in a predictable way gets a lot more complicated when you separate dimensions. You lose Bezier handles in the Comp panel, and modifying a curved path becomes almost impossible. 

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 ,
Sep 16, 2023 Sep 16, 2023

Correct, I work on separated values. I only change x value. But I don't want to reverse the keyframes. Now the object moves to the left side of the comp (so the x values decrease). And  I want the object to start exactly at the same x value but move to the right side of the comp (so the x values increase). I want the corresponding values to stay at the same distances but to go the other way. Sorry for my english, I'm trying my best 🙂 

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 ,
Sep 16, 2023 Sep 16, 2023

Try this for X Position:

key(1).value - (value - key(1).value)
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 ,
Sep 18, 2023 Sep 18, 2023
LATEST

Thank you guys so much!

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 ,
Sep 16, 2023 Sep 16, 2023

You have a bunch of keyframes, so the easiest way to reverse the direction of the movement from the first keyframe to the last keyframe would be to add this simple expression:

 

mov = key(1).value - value + key(1).value

or Dan's expression. Both will work. 

 

You could also modify the expression to work with an array so that only the X value reversed direction with you don't separate values.

x = key(1).value[0] - value[0] + key(1).value[0];
y = value[1];
[x, y]

That would give you the option of modifying the original motion path in the Comp panel like this;

RickGerard_0-1694889991999.gif

 

 

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