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

Can anyone help me fix this transition expression? Almost there!

Explorer ,
Apr 14, 2023 Apr 14, 2023

Copy link to clipboard

Copied

Hi

 

I am creating a transition animation for many layers where both the duration of time the layer is showing and the time it takes for the effect transition (image wipe & scale) need to decrease for each one in turn.

 

For example:

Layer 1 - Show image without changing for 0.5s, then image wipe from 0-100 and scale from 50-64 for 0.5s.

Layer 2 - Show without changing for 0.49s, then same transition as above for 0.49s.

Layer 3 - 0.485s, 0.485s

And so on...

 

I have about 60 images (I know I can't go these exact timings as it's 24fps but it's just to give an idea of what I need). I'm aaaalmost there, now each layer transition decreases in time (but the overall "screen time" of each layer stays exactly the same)

 

Here is what I have so far:

LAYER 1:

 

duration = 0.5;

linear(time, inPoint, inPoint + duration, 0, 100)

 

 

LAYER 2 ONWARDS

 

prevLayer = index - 1;

prevDuration = thisComp.layer(prevLayer).effect("CC Image Wipe")("Completion").key(2).time + thisComp.layer(prevLayer).inPoint;

duration = Math.pow(0.95, prevLayer - 1) * prevDuration;

startAt = thisComp.layer(index).inPoint + (prevDuration * (prevLayer - 1)); 
endAt = startAt + duration;

linear(time, startAt, endAt, 0, 100)

 

 

As I don't know exactly how long I want the overall composition to be (I will play with the start duration and the multiplier) all the layers are compositions that are 1.5mins long each. I know it's just for image wipe but tbh i'll be happy with just that for now, i'm sure i could copy it across for scale if i can get it working.

 

I've shared a cut down version of the project with 3 images that repeat with it all set up here:

https://drive.google.com/drive/folders/1kJSaabXoqbsYpH2PNh52O3CFfi4HhuFY?usp=sharing

Access is set so anyone with link can edit, so if it would be easier to save over this to show me that would be cool too!

 

I've posted a few times in more than 1 place but only manage to progress somewhat each time before the post goes cold so if anyone can help me get it across the line i'd really appreciate it!

 

Thanks

TOPICS
Error or problem , Expressions

Views

325

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

correct answers 1 Correct answer

Community Expert , Apr 17, 2023 Apr 17, 2023

I don't have time to figure this out right now, but if you use the layer index as a multiplier, you can generate a decreasing time value for the start of a calculation on each succeeding layer. 

 

The biggest problem with your approach is that After Effects calculates every pixel on every layer for every frame. A much more efficient way of working the problem would be to create an animation preset that setup the animation based on the layer in and out points or even just keyframes, then apply th

...

Votes

Translate

Translate
Community Expert ,
Apr 17, 2023 Apr 17, 2023

Copy link to clipboard

Copied

I don't have time to figure this out right now, but if you use the layer index as a multiplier, you can generate a decreasing time value for the start of a calculation on each succeeding layer. 

 

The biggest problem with your approach is that After Effects calculates every pixel on every layer for every frame. A much more efficient way of working the problem would be to create an animation preset that setup the animation based on the layer in and out points or even just keyframes, then apply that preset to all of the layers in the composition, then use the Keyframe Assistant to sequence the trimmed layers. This approach will make all of the animations the same length. To make each animation take less time for each layer, just pre-compose the layers, apply Time Remapping, then use the value graph, shorten up the animation to the desired final length, and adjust the curve to make each successive animation take a bit less time.

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
Explorer ,
Apr 18, 2023 Apr 18, 2023

Copy link to clipboard

Copied

I had to look up a few things because i'm quite new to all this but this is such a simpler and better solution, thank you so much! It finally works!

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
Community Expert ,
Apr 18, 2023 Apr 18, 2023

Copy link to clipboard

Copied

LATEST

Just in case you are interested, this expression uses two sliders to define a duration and a decay percentage for a layer based on the layer index. The controllers are placed on a Null 1 Controller layer. If the decay slider is se to zero, every layer will have the same starting time based on the Duration slider. With the duration set to 2, Layer 1 will start at the layer in-point, and Layer 5 will start 10 seconds after its in-point.  Set the decay to 50%, and Layer 5 will start at 6 seconds. 

ctrl = thisComp.layer("Null 1 Controlls");
n = index - ctrl.index;
if (n == 1)
	m = 0
else
	m = n -1;
dur = ctrl.effect("Duration")("Slider") * m;
decay = ctrl.effect("Decay")("Slider") * .01 * m;
tTime = dur - decay;
t = time - inPoint - tTime;

This would be the starting point for an expression that does something at a time defined by the layer index. With this as a starting point, you can use the linear interpolation method to fade in opacity or fade it in and out using logic statements (if (this) make something happen). 

 

Maybe this will help in the future. It is still a lot more complicated than just sequencing the layers and fiddling with Time Remapping the pre-comp. 

 

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