Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Control the speed

  • Moira Elefson

    March 21, 2018 at 8:14 am

    It seems like i will not get an answer

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

  • Steve Bentley

    March 21, 2018 at 8:35 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.

  • Moira Elefson

    March 21, 2018 at 8:54 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

  • Andrei Popa

    March 21, 2018 at 9:30 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.

  • Steve Bentley

    March 21, 2018 at 10:30 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)

  • Moira Elefson

    March 21, 2018 at 3:15 pm

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

    Have a nice day

  • Kevin Camp

    March 21, 2018 at 5:52 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

  • Kevin Camp

    March 21, 2018 at 7:21 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

  • Din Iulian silviu

    May 23, 2018 at 1:27 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!

  • Steve Bentley

    May 23, 2018 at 3:31 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).

Page 2 of 3

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy