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

Comparing values in two different frames (expression?)

Explorer ,
Jul 28, 2025 Jul 28, 2025

Hello,

 

I need to compare values between 2 consecutive frames (in this case the Y position). How do I get that value in the previous frame?

 

Once I have that it's just if-else from there on.

TOPICS
Error or problem , Expressions , How to
181
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 28, 2025 Jul 28, 2025

With a Google search I managed to put together this but it just gives me value 100 in every situation. VB is the variable for ValueBefore, VN means ValueNow...

 

VB = comp("Comp 1").layer("Red").transform.yPosition.valueAtTime(time - framesToTime(1));

VN = comp("Comp 1").layer("Red").transform.yPosition.valueAtTime;

if (VB <= VN) {T=0} else {T=100};

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 Expert ,
Jul 28, 2025 Jul 28, 2025
LATEST

You were close:

VB = comp("Comp 1").layer("Red").transform.yPosition.valueAtTime(time - framesToTime(1));
VN = comp("Comp 1").layer("Red").transform.yPosition.valueAtTime(time);
if (VB <= VN) {T = 0} else {T = 100};
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