FORUMS: list search recent posts

Control the speed

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Marius Ionasco
Control the speed
on Mar 20, 2018 at 7:17:56 pm



I have an optical flare that is moving according to a custom path. That path is looped out for extension. I must create a expression that would allow me to control the speed of the moving object.
For example: Speed_of_object=x
And that x would be an output value from sound keys.

Pls. help with speed part.


Return to posts index

Steve Bentley
Re: Control the speed
on Mar 20, 2018 at 9:42:54 pm

Hi Marius,
I'm not sure what you are trying to do. The loop out expression just repeats the motion set by the keyframes in the position parameter once the last keyframe has been handled.
If you attach the motion of the lens flare to the output of soundkeys (I assume that's what you are after) that flare is going bounce all over the place like crazy.
Are you trying to have the flare travel along a path so that the soundkey data controls its position along that path?



Return to posts index

Marius Ionasco
Re: Control the speed
on Mar 20, 2018 at 9:59:52 pm

The sound keys must control the speed of executing the path. When the music is with more bass the flare is moving faster according to the path.


Return to posts index


Steve Bentley
Re: Control the speed
on Mar 20, 2018 at 10:05:05 pm

The problem is that a bass hit is instantaeous. So the flare will jump to the end of the path then retract to the beginning. Is that what you are after?



Return to posts index

Marius Ionasco
Re: Control the speed
on Mar 20, 2018 at 10:12:54 pm

Do not worry about the bass. We must find out a way to control the speed of comp with an integer or variable


Return to posts index

Marius Ionasco
Re: Control the speed
on Mar 20, 2018 at 10:15:59 pm

So initially the speed of comp is 1 .
I must control that somehow to be 1.3 , 1.5 or what else


Return to posts index


Steve Bentley
Re: Control the speed
on Mar 20, 2018 at 10:22:15 pm

I'm not sure what you mean by "Speed of comp".
If you have an expression going you can always add a slider (expression controls/slider) and then tie that value to your expression. Then you can keyframe that value and change it over time.



Return to posts index

Marius Ionasco
Re: Control the speed
on Mar 21, 2018 at 6:19:45 am

Can I set the amount of frames played from that animation in a second ?


Return to posts index

Steve Bentley
Re: Control the speed
on Mar 21, 2018 at 6:46:20 am

You can set the frame rate in the comp settings (cntrl K). But you can't change that interactively. You can change the fps after you start working on the comp but be warned that it may mess with where footage ends and how animations happen. After effects for the most part doesn't care about frames per second - it just sees a frame as a frame and renders out every frame in the time line. The FPS setting just tells AE how fast to ripple through those frames.
But it also tells AE how to consider footage that isn't at the same fps rate as the comp. A 15fps movie put into a 30fps comp can appear to be half as long as the length it ran in say something like QT movie player. Because AE is looking at say 10 seconds of footage (at 15fps that's 150 frames) and you are putting that into a 30 fps comp where AE expects 10 seconds to be 300 frames, so AE can take every frame of that 150 and put it in every frame "slot" of the 30fps comp, and the footage would end at the half way mark.
But you can alter this behavior. You can tell AE to "interpret footage" and assume that its at 15fps or 30 fps or whatever. Tell it to assume the footage is at 15fps and the 10 second clip will last 300 frames in your 30fps time line, but with every frame doubled to stretch the time out. Or you can say interpret at 30 fps and you will get what happens in the first example above. (AE tends to import footage and "interpret as" based on what you did last time it was open)
You can also do the opposite and tell AE to imagine the clip is running at 60 fps and then AE will make the clip only last 1/4 of the 10 second 30fps comp length.

Think about it as "how do you want every single frame of your source footage (no matter the frame rate) to placed in each frame "slot" in your project.
I find it also helpful to not work in Minutes and seconds in the AE comp and work in frames instead. This also helps with the dreaded Zero frame problem and with a number of the time warping effects that rely on frame information and with expressions that often work better with frame information instead of 0.033 of second.
Music files are a little different in that they respect the fps rate of the comp - music files don't really have frames or frames per second in the movie sense. So a 1 minute music file will last 1 minute in your comp's timeline no matter what fps the comp is set to.



Return to posts index


Marius Ionasco
Re: Control the speed
on Mar 21, 2018 at 7:17:20 am

Why it's so difficult to explain that 😭

ok i will send a link to a video

https://youtu.be/U2e8ZayOEVs

so that flare must move faster to that trajectory, but without moving the keyframes


Return to posts index

Steve Bentley
Re: Control the speed
on Mar 21, 2018 at 7:59:27 am

The keyframes are what cause the motion - the loop expression just makes it happen again and again.
So you can do a few things - squeeze the keyframes together (select them all and alt-drag them from the end toward the beginning, they will all scale in time correctly.
Or you can precomp that layer (move all attributes to the new comp) and then time warp the precomp shorter (or enable time remapping and shrink the keyframes on that, or use the time warp effect etc)



Return to posts index

Marius Ionasco
Re: Control the speed
on Mar 21, 2018 at 8:14:20 am

It seems like i will not get an answer

Can i adjust the speed without editing the keyframes (with an expesion or smth) ?


Return to posts index


Steve Bentley
Re: Control the speed
on Mar 21, 2018 at 8:35:54 am

In expressions, After effects only references the frame you are on and any data on that layer or other layers on that frame also. So you can't say : make that go faster because the expression only knows the position on that frame and not where the object will be on the next frame or where it was the frame before. The only way to speed something up is to time warp the layer or move the keyframes or change the fps.
Lets try this another way:
Where did the keyframes come from that are on that layer? Did you do them by hand or are they a nodes on a spline?
Why do you not want to move those keyframes?
If we knew a bit more we might be able to help. Can you tell us what the data coming from Sound keys is supposed to do to the lens flare? Can you tell us what you want it to look like? there might be another way.

If you want a value from Sound Keys to control the speed of the flare going around the circle, think about it this way. For every frame sound keys will send a new value to your expression. So every frame will have a different velocity for the flare. Velocity on one frame is not speed. If you took still pictures of a race car going different speeds and made each picture a frame in a movie the only way you would know the car was going faster or slower is by the amount of blur in the background. Speed is distance/time. and there is no Time component on a single frame.
You need to tie the output of Sound keys to a position around the circle. the higher the value the farther the flare moves to around the circle. But if you get a different value on every frame from Soundkeys (and you will) the flare will just bounce around to seemingly random positions on each frame. If the flare was on a a straight line (think VU meter) you would see it "traveling" especially if it had a trail but without the trail it will just appear to be occupying a different position on each frame - that's why VU's "build up" otherwise it would just be a chaotic LED bouncing around.
Are you after a round VU meter? If so the the flare will need a tail so you know where the "zero" mark is and how far it traveled.



Return to posts index

Marius Ionasco
Re: Control the speed
on Mar 21, 2018 at 8:54:49 am

The flare is moving according to a path that i pasted from a shape layer (circle)

I would like that flare to move with a constant speed as in the video when for example the output of sound keys would be from 0 to 20 and to begin to move faster when is from 20 to 100 , but no matter the value from that interval [20,100] it must accelerate through a kinda exponential way such as 0.5x^2 but also stop at a ceratain speed limit.

I am trying to create a template of audio reaktor, but this is the base and i can't go further without finishing this step


Return to posts index

Andrei Popa
Re: Control the speed
on Mar 21, 2018 at 9:30:42 am

I don't know if what you want is possible through a simple expression. The problem is that expressions don't have memory. Once the timeline goes to the next frame, all that the expression calculated is lost, and the expression runs again. The problem with what you want is that the expression must remember how fast the flare went the frame before and the frame before and so on. In order to do that you would maybe need to create an expression that goes from the beginning of the comp and calculates every value until the present frame. On each frame. That would translate by an exponential increased render time for each second you have in your composition.

Andrei
My Envato portfolio.


Return to posts index


Steve Bentley
Re: Control the speed
on Mar 21, 2018 at 10:30:08 am

But you could get the value from SoundKeys and add it to the position of the flare - the higher the VU in Soundkeys the larger the increase in position would be and therefore (in a way, speed). The problem is (as we've been saying) the object you want to move is also the object you want to get the past position from to add the new value to.
You aren't the first to try and crack this nut, even with sound - here's a link to a past attempt - https://forums.creativecow.net/thread/227/32023
Dan Ebberts is the scripting guru in these parts and if he can't solve it can't be solved.
I've been trying to think of a way you could have two versions of the flare to help you out, one would be the one you see and one would be hidden but hold the value it was on from the last frame.
You would use something like this - positionOnLastFrame = Math.round(thisComp.layer("layer 2").position.value_at_time(currentTime-1)[1]) ;
Where: positionOnLastFrame is just a variable to hold the value of the position during the last frame, currentTime-1 is in frames (you have to do some conversion here as AE does time in seconds, so a frame is 0.033 seconds, but there are built in converting commands in the scripts hint window and it would just make the code here a mess to include and less understandable)
The [1] at the end retrieves the second parameter of the position data (the Y)

But the issue is that the expression is not leaving a trail of keyframes behind from which to grab the position data from currentFrame-1. Once the frame has passed the flare is in a new position and it has no memory of where it was.

Now if you could send the SoundKeys data to a null with an expression and then convert the expression to keyframes, you could do whats called an accumulator. Because you now have keyframes of the intensity of the range you are tracking in SOundKeys you can figure out for each keyframe where the flare should be. But you have to make loop in your code that will look at each frame from frame 0 up to the current frame (what Andrei was hinting at)
So at frame 0 you would take the initial position of the flare (which you would get from a keyframe on the flare at frame 0, then add the value of the sound key at frame zero. Then at frame 1 you would add the original position of the flare at frame 0 to the values you get from the SoundKey keyframes at frame 0 and frame 1. And you repeat that process for every frame. The higher the value from SoundKeys the farther the flare will move on that frame simulating a speed calc. You can even put a: if (valueOfSoundKey > someMaximum) { valueOfSoundKey==someMaximum); this would limit the top value's affect on the position: ie 80 percent or 100 percent would move the flare by the same amount if someMaximim=80.
The problem is by the time you get down to 1 minute of music you will be doing 3600 calculations per frame and expressions are very slow in AE (compared to compiled C+ code)



Return to posts index

Marius Ionasco
Re: Control the speed
on Mar 21, 2018 at 3:15:51 pm

Thank you for your time and explanations
I would need some time to handle all that information

Have a nice day


Return to posts index

Kevin Camp
Re: Control the speed
on Mar 21, 2018 at 5:52:44 pm

try this:

trim your comp to the last keyframe, then drop that comp into a new, longer comp. Enable time remapping for the nested comp (with the animated flare), go one frame before the last time-remap keyframe and add a keyframe, then delete the last keyframe. then add a loopOut() expresion to the time-remap property and extend the layer duration to fill the comp.

you should have your looping animation again.

now add timewarp and add an expression for the speed property to link it to the soundkeys output... something like this:
soundKeys = thisComp.layer('soundkeys') ; // point this to your soundkeys layer/property
value * soundKeys


see if that get's you close.

as most have pointe out, this is tough to do with expressions, but i think timewarp may be able to work.

Kevin Camp
Art Director
KCPQ, KZJO & KRCW


Return to posts index


Kevin Camp
Re: Control the speed
on Mar 21, 2018 at 7:21:25 pm

if the levels go bellow 1 (which is likely), you'll want to make sure that value won't go bellow 1....

you could simply add 1 to the soundKeys value, so the las line could look like this:
value * ( soundKeys + 1 )

Kevin Camp
Art Director
KCPQ, KZJO & KRCW


Return to posts index

Din Iulian Silviu
Re: Control the speed
on May 23, 2018 at 1:27:50 pm

Hi there,

I avoided creating a new topic for something very simple ...

• I want to enable or disable an effect from another composition using "expression controls"
(I added "fill" effect in a secondary composition and I created a "null object" in the main composition and I want to enable or disable from this null object using expression controls )

I searched for a tutorial but I can not find it...,

Who can help me with this?

Warm Regards!


Return to posts index

Steve Bentley
Re: Control the speed
on May 23, 2018 at 3:31:38 pm

The simplest way is to make two layers, one with the effect and one without. Then tie the opacity of both layers in the precomp to a property in the layer in the outer comp (a check box effect would do the trick or its transparency). Then when the check box is on set the top layer to opacity 100 and the bottom layer to zero. Do the opposite when the checkbox is off. And yes you can animate the checkbox(but only with hold frames).



Return to posts index

Din Iulian Silviu
Re: Control the speed
on May 23, 2018 at 7:25:18 pm

Good idea, thank you!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]