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

Check for keyframe on another layer

New Here ,
Apr 10, 2020 Apr 10, 2020

Copy link to clipboard

Copied

I have two layers, A and B. LayerA is a precomp containing drawings for an animation, with time remapping keyframes to display the drawings in the correct locations on the timeline. LayerB is a precomp containing a sequence of 5 texture images. I'd like to write an expression on LayerB to change the frame it is displaying whenever a keyframe is present in LayerA.

 

I found the following expression on this forum which works well, although I'd like to understand better what var t is. I know it is used to break the for loop but that's about it.

seedRandom(1,true);
var t=timeToFrames();
var r1=-3;
var r2=-2;
var r3=-1;
for (var i=0;t>=i; i++) {
   var r3=Math.floor(random(5));
   if (r1==r3 || r2==r3) {
      t++;
      continue;
   }
   r1=r2;
   r2=r3;
}
framesToTime(r3);

As for checking for the presence of a time remap keyframe on another layer, I'm clueless as to where to start. Any advice would be appreciated.

 

TOPICS
Expressions

Views

111

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
LEGEND ,
Apr 11, 2020 Apr 11, 2020

Copy link to clipboard

Copied

LATEST

Not sure what you need to know. Isn't it obvious what a verbose functiuon called timeToFrames() does? It's literally spelled out.

 

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