how to change layer property based on other layer keyframes time reached?

Community Beginner ,
Jul 23, 2020

Copy link to clipboard

Copied

So I have 2 layers and i want to automatically change the 1st layer opacity turns from 100 to 0 and vice versa after the time reach every 4 keyframes on 2nd layer scale property.

Im sorry for my bad explanation xD. Please help. Thanks!

Like this maybe:

 

n = 0;
s = thisComp.layer("2nd layer").scale;
if (s.numKeys > 0){
n = s.nearestKey(time).index;
if (time < s.key(n).time) n--;
}
Math.floor(n/4)%2 ? 0 : 100

 

Dan

TOPICS
Expressions, How to, Scripting

Views

53

Likes

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

how to change layer property based on other layer keyframes time reached?

Community Beginner ,
Jul 23, 2020

Copy link to clipboard

Copied

So I have 2 layers and i want to automatically change the 1st layer opacity turns from 100 to 0 and vice versa after the time reach every 4 keyframes on 2nd layer scale property.

Im sorry for my bad explanation xD. Please help. Thanks!

Like this maybe:

 

n = 0;
s = thisComp.layer("2nd layer").scale;
if (s.numKeys > 0){
n = s.nearestKey(time).index;
if (time < s.key(n).time) n--;
}
Math.floor(n/4)%2 ? 0 : 100

 

Dan

TOPICS
Expressions, How to, Scripting

Views

54

Likes

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
Jul 23, 2020 0
Most Valuable Participant ,
Jul 23, 2020

Copy link to clipboard

Copied

Could be as trivial as something like that:

 

mLay=thisComp.layer("XYZ");
mScale=mLay.transform.scale;
mKeys=mScale.numKeys;

linear(time,mScale.key(mKeys-1).time,mScale.key(mKeys).time,0,100)

 

Mylenium

Likes

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
Reply
Loading...
Jul 23, 2020 0
Guide ,
Jul 23, 2020

Copy link to clipboard

Copied

Like this maybe:

 

n = 0;
s = thisComp.layer("2nd layer").scale;
if (s.numKeys > 0){
n = s.nearestKey(time).index;
if (time < s.key(n).time) n--;
}
Math.floor(n/4)%2 ? 0 : 100

 

Dan

Likes

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
Reply
Loading...
Jul 23, 2020 0