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

Triggering animation with layer markers

New Here ,
May 15, 2024 May 15, 2024

Copy link to clipboard

Copied

Hi Everyone,

I need help to refine this expression of triggering animation with layer markers.

I have animation of a text that starts with key 1 to key 2 and then this text transition to another text key 3 to key 4 and then text out key 5 to key 6.

The 2 texts layers are pre composed, and my expression is applied into the Time remapping with these 6 keys.

Basecaly, the expression works fine, just I'm getting expression error for this line 

if (time < T.marker.key(1).time)
linear(time,inPoint.time,key(2).time,key(1).value,key(2).value)
else

 

Everytime, I move my timeline indecator before my marker.key(1). But the expression keeps working fine.

 

This is my expression:

T = thisLayer;
if ((T.marker.numKeys > 1 ) && (numKeys > 5)){
dIn = key(4).time - key(3).time;
dTr = key(2).time - key(1).time;
dOut = key(6).time - key(5).time;
eIn = T.marker.key(1).time;
eOut = T.marker.key(2).time;

if (time < T.marker.key(1).time)
linear(time,inPoint.time,key(2).time,key(1).value,key(2).value)
else
value

if (time < T.marker.key(2).time)
linear(time,eIn,eIn+dIn,key(3).value,key(4).value)
else
linear(time,eOut,eOut+dOut,key(5).value,key(6).value);
}else
value;

 

Thank you for your help

TOPICS
Expressions

Views

234

Translate

Translate

Report

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

Community Expert , May 15, 2024 May 15, 2024

In that case, I think it would be like this:

if ((marker.numKeys > 1 ) && (numKeys > 5)){
  dIn = key(2).time - key(1).time;
  dTr = key(4).time - key(3).time;
  dOut = key(6).time - key(5).time;
  eIn = marker.key(1).time;
  eOut = marker.key(2).time;

  if (time < eIn)
    linear(time,inPoint,inPoint+dIn,key(1).value,key(2).value)
  else if (time < eOut)
    linear(time,eIn,eIn+dTr,key(3).value,key(4).value)
  else
    linear(time,eOut,eOut+dOut,key(5).value,key(6).value);
}else
  value;

Votes

Translate

Translate
LEGEND ,
May 15, 2024 May 15, 2024

Copy link to clipboard

Copied

Your branching in the conditional is wrong. The precedence is

 

if

else if

else

 

Also your code is sloppy. Even else statements require ( ). Fix your syntax and formatting and it should work correctly.

 

Mylenium

Votes

Translate

Translate

Report

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
New Here ,
May 15, 2024 May 15, 2024

Copy link to clipboard

Copied

I'm new to expression, Can you please help me to fix the code.

Thanks

Votes

Translate

Translate

Report

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 ,
May 15, 2024 May 15, 2024

Copy link to clipboard

Copied

What is it supposed to do?

Votes

Translate

Translate

Report

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
New Here ,
May 15, 2024 May 15, 2024

Copy link to clipboard

Copied

I have 3 animations In, transion and Out

The In can be always at the bigenning of the layer, first marker should trigger the transition and then the second marker should trigger the Out.

 

Votes

Translate

Translate

Report

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 ,
May 15, 2024 May 15, 2024

Copy link to clipboard

Copied

In your code, it looks like the transition happens before the In, is that correct?

Votes

Translate

Translate

Report

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
New Here ,
May 15, 2024 May 15, 2024

Copy link to clipboard

Copied

The In animation can always starts at the inPoint of my layer (it doesn't need a trigger). transition should be triggered by marker.key(1) and then Out should be triggered by marker.key(2)

Votes

Translate

Translate

Report

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
New Here ,
May 15, 2024 May 15, 2024

Copy link to clipboard

Copied

chadinko1_0-1715793074555.png

 

Votes

Translate

Translate

Report

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 ,
May 15, 2024 May 15, 2024

Copy link to clipboard

Copied

In that case, I think it would be like this:

if ((marker.numKeys > 1 ) && (numKeys > 5)){
  dIn = key(2).time - key(1).time;
  dTr = key(4).time - key(3).time;
  dOut = key(6).time - key(5).time;
  eIn = marker.key(1).time;
  eOut = marker.key(2).time;

  if (time < eIn)
    linear(time,inPoint,inPoint+dIn,key(1).value,key(2).value)
  else if (time < eOut)
    linear(time,eIn,eIn+dTr,key(3).value,key(4).value)
  else
    linear(time,eOut,eOut+dOut,key(5).value,key(6).value);
}else
  value;

Votes

Translate

Translate

Report

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
New Here ,
May 15, 2024 May 15, 2024

Copy link to clipboard

Copied

LATEST

Working perfectly.

Thank you very much for your help, much appreciate it.

 

Votes

Translate

Translate

Report

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