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

Two expressions on a single property

Community Beginner ,
Mar 23, 2019 Mar 23, 2019

Hey guys, I've a time delay expression and I need to add a loopOut in the same property of position.

framesToDelay=3*index;

delay=framesToTime(framesToDelay);

thisComp.layer("drop").transform.position.valueAtTime(time-delay);

and I want to also add

loopOut("continue")

both in the position property. Is it possible?

Thank you in advance.

4.9K
Translate
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
Community Expert ,
Mar 23, 2019 Mar 23, 2019

I would put the loopOut("continue") in the drop layer's animation.

On the other hand, I don't think you want the motion to continue, I think you want the offset to increase as time passes. Let us know if that's what you want. You would do that by multiplying the frames to delay by the time or by adding time to the delay.

Something like this:

framesToDelay=index * time * 3;

delay=framesToTime(framesToDelay);

p = thisComp.layer("drop").transform.position.valueAtTime(time-delay);

I'm not exactly sure what you are trying to do.

Translate
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
Community Beginner ,
Mar 23, 2019 Mar 23, 2019

I have a water-drops falling and and I need this animation to be repeated for 20 seconds.

What I did till now: I made the drop and add the following expression:

framesToDelay=3*index;

delay=framesToTime(framesToDelay);

thisComp.layer("drop").transform.position.valueAtTime(time-delay);

and finally I duplicated 2 times in order to have 3 water-drops.

And now I want this to be repeated for 20 seconds.

Translate
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
Community Expert ,
Mar 23, 2019 Mar 23, 2019

I take it that the "drop" layer is falling down. If you want the drop layer to fall down then fall down again just type loopOut() on that layer and the drop will fall again and again. If you use loopOut("continue") the first drop will fall down then continue off the screen. "Cycle" is the default so you don't need to specify that. "pingpong" makes the animation go back and forward.

Your original expression will make the other layers follow the original layer. Each drop will follow the original path precisely. If you want the drops in a different place you have to add a value + at the start of the last line in your original expression. Here's a sample comp that took me less than 3 minutes to create: Dropbox - water drop.aep If your browser adds a TXT extension to the AEP file just delete it.

Screenshot_2019-03-23 15.06.37_MzfQfn.png

Translate
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
Community Beginner ,
Mar 24, 2019 Mar 24, 2019

If I understand correctly you put a simple position in layer "drop" and just loop it. Then you duplicate it and instead of loop you put the other 3 line expression that made layer follow the previous one. Am I correct?

Translate
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
Community Expert ,
Mar 24, 2019 Mar 24, 2019

Did you open the sample comp? All I did was loop the first water drop, then apply a slightly modified copy of your expression to the other drops. They could have been different shapes. You could even apply the expression idea to the path I used to create the drop or a shape layer animator to make each drop unique.

If the sample comp is something like your design idea then we have solved your problem.

Translate
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
Community Beginner ,
Mar 24, 2019 Mar 24, 2019

Yes my friend I opened it and thank you very much for the help.

But I still want to ask for educational purposes, is it possible to stack 2 or more expressions in a single property in order to do this or your way is the only way to do it?

PS: I'm newbie to AE and I make kinetic posters and typography.

Are there any books to help me? You seem to have a lot of experience! Thanks again.

Translate
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
Mentor ,
Mar 24, 2019 Mar 24, 2019

Yes, you can stack expressions, but it's not just like stacking effects.

One way would be to apply the first expression as you always do. Then you add the transition effect, which gives you a second set of position, scale, rotation and so on. You can add the second expression to this effect. Following this logic, you can also outsource the expression to a Null-layer and parent your artwork to this one.

Another way would be to understand that expressions calculate a value and that stacking expressions is nothing more than adding the result of two or more calculations.

In your example, the trick would be to loop "time" which can easily done with modulo operator. Instead of using "time" as it is, you would modified it to:

     t = time % looptime;

You set up looptime as you wish and keep using t instead of time. Modulo is always a great way to make ongoing numbers to repeating ones.

You are free to use every if/else statement to switch between expressions, too.

But keep in mind that is sometimes faster and easier to just "keyframe the thing", than spending days in developing an expression, which you only need once.

Happy coding!

*Martin

Translate
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
Community Expert ,
Mar 24, 2019 Mar 24, 2019
LATEST

You can't just add a loop to the bottom of an expression. You can do a lot of things, but that is not how the loop method works. It looks for keyframes.

There are other ways to offset time and make things repeat, but you always face the danger of writing a recursive expression that slows down every time it calculates.

I suggest you spend some time with the user guide and take a few hours and carefully read everything Dan Ebberts has posted on his websites. It won't take that long.

There are also rumors of additional Javascript methods becoming available so it might be a good idea to schedule some time to study up on that. After Effects has specific and methods and properties (layer, position, loopOut, thisComp, thisLayer and so on) but most of the existing Java math operations can be applied to an expression.

Translate
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