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

Animated background for Responsive Design project

New Here ,
Mar 06, 2024 Mar 06, 2024

Copy link to clipboard

Copied

I have a little problem here. I am currently working on a project that requires the background to be cyclic. I have a composition that has a pre-composition that needs to be modified so that there are opening and ending segments, as well as an animated background.

The task is to make a graphic element with a duration of 289 frames. 14 frames for the opener and 25 for the ending. the video itself lasts 10 seconds.

The video is in the preliminary composition which is located in the main composition. Changing the duration of the pre-composition takes place in the main composition. I was thinking about how to solve this problem and came up with the following option:

I use an expression to calculate the acceleration coefficient, then use Time Remaping to speed up the clip. The problem is that to speed up the clip has succeeded, but to loop it in any way does not work. When using loopOut("cycle") the speed change is reset.

Here's what I'm using:

TimeChange=time * timeToFrames(comp("TEST_COMP").layer(1).outPoint) / 289
TimeChange
loopOut("cycle")

What can be done in this situation and how to solve the problem?

PS. The element should be used in Essencial Graphics.

TOPICS
Error or problem , Expressions , Scripting

Views

136

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 ,
Mar 06, 2024 Mar 06, 2024

Copy link to clipboard

Copied

The problem is that loopOut() will cause the expression engine to ignore everything previous to that in the expression. You need to create your own loopOut functionality, probably by using the the JavaScript modulo operator (%). I'm not sure this is exactly what you're looking for, but try replacing your last two lines with this:

TimeChange % framesToTime(289)

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 ,
Mar 07, 2024 Mar 07, 2024

Copy link to clipboard

Copied

LATEST

Could you avoid expressions altogether and use track mattes instead?  Or is it that the animation is all part of the same layer and the out sequence is already set in the same layer, so you need to looping to end always on the last 25th frame?

 

If it is the latter, I played with one of Dan's expressions (thank you as always Dan) and came up with this.  I made an essential graphic of a photon torpedo (0 to 5 seconds) which looped until a second position keyframe, and then played an explosion.

var endLoop = 5;
var endExplosion = 10;

var p = transform.position;
var val = 0;
if(p.numKeys > 0){
    n = p.nearestKey(time).index;
    if(p.key(n).time > time) {
	    n--;
    }
    if(n == 2){
        t = p.key(n).time;
        if(time < t+endExplosion){
            val = linear(time, t, t+endExplosion, endLoop, endExplosion);
        } else {
            val = endExplosion;
		}
    } else {
		loopTime = (time - key(1).time)%endLoop;
		val = valueAtTime(key(1).time + loopTime);		
	}
}
val

 

Last thought, have you tried loopIn() instead of loopOut(), that always ends the loop on a keyframe and can then continue playing.

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