Skip to main content
Inspiring
July 29, 2022
Answered

A script to link a value on one layer to different ranges of frames from multiple layers?

  • July 29, 2022
  • 1 reply
  • 1745 views

Greetings,

 

Could anyone provide a script to link a value like Scale on Layer3 to the Scale values of Layer1 for frames 1 to 48 and then link the Layer3 Scale values to frames 49 to 96 of Layer2?

 

Thanks for any help on this 🙂

This topic has been closed for replies.
Correct answer Dan Ebberts

Nothing jumps out at me, but I think I'd probably set it up more like this (I haven't tested this at all, so it's probably not exactly right):

frames = [102770,102796,102865,102968,103018,103188,103208,103318,103411,103457,103486,103572,103608,103666,103751,103780,103809,103846,104039];
tracks  = ["01",    "01b",   "02",     "03",    "04",     "05",    "06",     "07",    "08",    "09",     "10",    "11",     "12",    "13",    "14",     "15",    "16",    "17",     "18"];
val = value;
f = timeToFrames(time);
for (i = 0; i < frames.length; i++){
  if (f < frames[i]){
    val = thisComp.layer("track" + tracks[i]).effect("Mocha Pro")("Center");
    break;
  }
}
val

1 reply

Dan Ebberts
Community Expert
Community Expert
July 29, 2022

It will probably be something like this, depending on what you want to happen after frame 96:

if (time < framesToTime(48)){
  thisComp.layer("Layer1").scale;
}else if (time < framesToTime(96)){
  thisComp.layer("Layer2").scale;
}else{
  value;
}
persystAuthor
Inspiring
July 29, 2022

Awesome, thank you very much!!!