LoopOut stop at certain time

New Here ,
Jun 24, 2022 Jun 24, 2022

Copy link to clipboard

Copied

I have a working loopOut and i'm trying to stop it at a certain time.

i tried:

timeToStop = 10; 
if (time > timeToStop) { 
value; 
} else { 
loopOut(); 
}

 

and also

 

if(time < 10){
loopOut()
}

else {
value
}

 

but both doesnt do the stopping trick, wel it stops right after one sequence...

What do I need to do to make this work? thanks!!

TOPICS
Error or problem , Expressions , How to

Views

91

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
community guidelines
Adobe Community Professional ,
Jun 24, 2022 Jun 24, 2022

Copy link to clipboard

Copied

Both of those stop after 10 seconds for me, although it's not a very graceful stop unless the length of the loop goes evenly into 10.

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
community guidelines
New Here ,
Jun 24, 2022 Jun 24, 2022

Copy link to clipboard

Copied

Hi, dont know why, but it does stop now. But now i dont get it started at a certain time. But that will be for a new post.

 

Gracefully, no it is not. But this is a whole lot for me yet to get this working 😉 

 

Can you put me in a direction to search for a smooth stop?

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
community guidelines
Adobe Community Professional ,
Jun 24, 2022 Jun 24, 2022

Copy link to clipboard

Copied

There are a number of different ways, but the simplest might be to either specify the number of loops, like this:

n = 3; // number of loops
if (numKeys > 1){
  t1 = key(1).time;
  t2 = key(numKeys).time;
  if (time < t1 + n*(t2-t1))
    loopOut()
  else
    key(numKeys).value;
}else
  value;

or, have it stop at the last full loop before your specified time:

timeToStop = 10;
if (numKeys > 1){
  t1 = key(1).time;
  t2 = key(numKeys).time;
  n = Math.floor((timeToStop - t1)/(t2 - t1));
  if (time < t1 + n*(t2-t1))
    loopOut()
  else
    key(numKeys).value;
}else
  value;

 

 

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
community guidelines
New Here ,
Jun 24, 2022 Jun 24, 2022

Copy link to clipboard

Copied

Wow, thank you! I will have to learn a lot...

Trying to understand and to read what you did. 

Will play with it and see what magical abracadabra you wrote to me! 

Thanks, here I can work with

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
community guidelines
Adobe Community Professional ,
Jun 25, 2022 Jun 25, 2022

Copy link to clipboard

Copied

By far the easiest way to stop a loop animation is to go to the frame closest to where you want the animation to stop and make sure that frame matches the first frame of the animation. This is easily done using the Comp snapshot camera. Then split the layer (Shift + Ctrl/Cmnd + D) and disable the expression on the duplicate. You'll be done in about 15 seconds. 

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
community guidelines
New Here ,
Jun 25, 2022 Jun 25, 2022

Copy link to clipboard

Copied

Thnx Richard  

Not sure if I follow what your saying.

Snapshot, ok, split layer ok, 

Dissable expression, you mean "stop loopOut thing" i think.

And from there Animate to the snapshot?

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
community guidelines
New Here ,
Jun 25, 2022 Jun 25, 2022

Copy link to clipboard

Copied

But how do you go from there? I dont get it yet. 

No, i read it multiple times trying to figure it out. But i have to see it what you mean.

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
community guidelines
Adobe Community Professional ,
Jun 25, 2022 Jun 25, 2022

Copy link to clipboard

Copied

Here is a very simple example.

  • Create a new HD composition that is 10 seconds long with a frame rate of 29.97 fps. 
  • Use the Pen tool (g) to set the first point of a vertical line in the upper right quarter of the composition with a stroke of about 10 pixels.
  • Hold down the Shift key and move down about 200 pixels and click once to create a single vertical line.
  • Select the Pan Behind Tool (y), make sure shaping is turned on, and move the Anchor Point of the Shape layer to the bottom vertex of the vertical line you just created
  • Hold down the Ctrl/Cmnd key and click on the Timeline timecode display to change the view from Timecode to Frames
  • Press Alt/Option + r to set the first Rotation keyframe then set the rotation value to - 15º
  • Double-click in the Timeline Frames display to move the Current Time Indicator to frame 12
  • Set the rotation value to 15º
  • Double-click in the Timeline Frames display to move the CTI to frame 24
  • Set the rotation property to - 15º
  • Alt/Option-click on the Rotation property to start an expression and type "loopo"
  • You should see loopOut() pop up highlighted in Blue the expression language panel, when you do press Enter then click off the layer to complete the loopOut() expression
  • The first and last keyframe is now identical now so you have a perfect loop that looks like a metronome
  • Double-click in the Timeline Frames display and enter 98 to move the CTI to frame 96 and you should see the Rotation value exactly at 15º
  • With the layer selected press Shift + D to split the layer, then the 'e' key twice to reveal the expression and disable it
  • Preview the comp

You should. have a metronome that clicks back and forth 4 times, then stops.

RickGerard_0-1656166830935.gif

That is usually how I stop an expression at a specific time. If I need to change the speed of the loop I just pre-compose both layers and apply time remapping. As long as the first and last frames of any animation sequence are identical you can create a perfect loop.

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
community guidelines
New Here ,
Jun 28, 2022 Jun 28, 2022

Copy link to clipboard

Copied

LATEST

Wow! Thank you so much, i will try this!!!

Really appreciate!

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
community guidelines