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.
Copy link to clipboard
Copied
Not sure what you need to know. Isn't it obvious what a verbose functiuon called timeToFrames() does? It's literally spelled out.
Mylenium