Skip to main content
Participant
November 10, 2022
Question

Contraint loop duration between intro and outro into protected areas

  • November 10, 2022
  • 2 replies
  • 257 views

I'm wondering how to keep the loop duration lenght of animation placed between two protected regions.

Here is the situation, I have for example a pre-composition with a 5 seconds duration :

 

- One protected region is set up from 0 to 2 sec to define the Intro in responsive design

- One protected region is set up from 4 to 5 sec to define the Outro in responsive design

- Random mouvement is applied to a layer by a wiggle loop with 1 sec duration

 

When I put this precomp into a master comp, I wanted to keep the 1 sec loop duration to my random mouvement, actually when I stretch the composition, Intro and Outro are protected which is good, but every thing between is streched, even the wiggle duration loop, I understand that's we are expecting from a non protected region, but I search a way to constraint the loop duration inside.

 

I've tried differents things, and I think I could be done if I could get the current time ( the time from the master composition, not from the inside pre composition ).

 

If anyone have an idea !

This topic has been closed for replies.

2 replies

Dan Ebberts
Community Expert
Community Expert
November 10, 2022

I'm not sure if you're using my looping wiggle code, but if so, this should give you an idea of how to adjust it maintain constant speed through a time-stretched non-protected region. It makes a lot of assumptions that may not match your situation, so if it doesn't work for you please post screen shots of your timelines and code (or even better, post a project file).

OK, here's the code:

L = comp("Master").layer(thisComp.name);
m = thisComp.marker;
p1 = m.key(1).time + m.key(1).duration;
p2 = m.key(m.numKeys).time;
unProt = p2 - p1;
prot = m.key(1).duration + m.key(m.numKeys).duration;
factor = (L.outPoint - L.startTime - prot)/unProt;
freq = 1;
amp = 400;
loopTime = 2;
if (time < p1){
  t = time % loopTime;
}else if (time < p2){
  t = (p1 + (time - p1)*factor)%loopTime;
}else{
  t = (p1 + unProt*factor + time - p2)%loopTime;
}
wiggle1 = wiggle(freq, amp, 1, 0.5, t);
wiggle2 = wiggle(freq, amp, 1, 0.5, t - loopTime);
linear(t, 0,  loopTime, wiggle1, wiggle2)
ShiveringCactus
Community Expert
Community Expert
November 10, 2022

Not sure what a wiggle loop is exactly, but I think something like this expression is what you're after:

if (time > thisLayer.startTime+2 && time < thisLayer.outPoint-1) {
	// WIGGLE LOOP (?) GOES HERE
} else {
	value
}