Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Bezier curves and expressions.

  • Bezier curves and expressions.

    Posted by Richie Tovell on January 7, 2010 at 4:58 pm

    Don’t know if the title of this thread is exactly right, but what I need to do is close to this, essentially incorporate one in to the other somehow.

    My question is, is it possible to connect two sliders using an expression that follows an exponential scale? so one slider acts as normally (the controlling slider) but the slider connected to it acts as though it was following a bezier curve the same as the curves in a graph editor?

    Second question, if this is possible, would it actually be possible to mark out this kind of bezier curve/path using say the keyframes of a null, then incorporate that graph in between the two sliders somehow? So the scale/bezier graph could be manipulated to effect the way the second slider responds to the first slider?

    Wow, I did a really good job explaining that, though I doubt that its likely to be possible, what do you guy’s think?

    Coda – [i]musical selections; in film, the ending or last section of a film (often wordless).[/i]

    Richie Tovell replied 16 years, 4 months ago 2 Members · 3 Replies
  • 3 Replies
  • Richie Tovell

    January 7, 2010 at 7:20 pm

    OK I’m updating this with a project, perhaps see it will help.

    At it’s simplest, I’m using trapcode sound keys to rotate and scale layers, but the rotation and scaling trapcode creates is constant, ie the layers it controls turn and expand at the same speed all the way through their movement, for example when the audio peak in sound keys hit’s 0-db the rotating layers moves to their furthest points, when the peaks in sound key’s drop to their minimum the rotating layers return to their starting points, all well and good, the problem I have is that I need the rotation to be exponentially scaled (as they are in the project), ie so it will travel at different speeds through out it’s rotation at first starting quickly then decreasing rapidly as if this path was marked out with a bezier graph and sound key’s was just telling the layer how far along this bezier path to move.

    If I was using keyframed movement instead of animated movement and sound keys, I could adjust the bezier curve in the keyframes in graph editor to rotate the layer as I liked (As I have here in this rough) but I don’t want to do that, I want to use soundkeys to form this shape, so the rotation of the layer is controlled by soundkeys, not keyframes on the timeline.

    This problem has been plaguing me for too many months now, I need any ideas at all.

    I though perhaps inserting an expression slider might help me bridg the gap, but I’m getting nowhere. The layers as you will see are parented and rotate/expand exponentially (this is only a rough at this stage and it needs a lot more tweaking to look good) once I’ve figured out a way over this sound key’s linking problem the shape will be pre comped, the idea being that footage and beats can simply then be dropped on to the layers and the footage will distort to this shape.

    Here is the project at it’s simplest.

    460_shape1.aep.zip

    Coda – [i]musical selections; in film, the ending or last section of a film (often wordless).[/i]

  • Dan Ebberts

    January 8, 2010 at 12:10 am

    I don’t know if this will help, but you can use Math.exp() to generate exponential curves. Say you have a slider (“Slider Control 2” in this example) with two keyframes, then you could calculate an exponential curve between the two values with something like this:

    slider = effect(“Slider Control 2”)(“Slider”) ;
    decay = 5.0;
    if (slider.numKeys < 2){ slider.value }else{ t = slider.key(1).time; v1 = slider.key(1).value; v2 = slider.key(2).value; if (time < t){ slider.valueAtTime(time); }else{ v2 + (v1-v2)/Math.exp(decay*(time-t)); } } You would set the steepness of the curve with the variable "decay" (or tie it to a slider). Dan

  • Richie Tovell

    January 8, 2010 at 1:08 am

    I think it might work, I’m not sure how to set this up though, I’m going to give it a shot now.

    Here’s how I’d like to use the expression (more precisely).

    Say, layer 1 rotates by 60 degrees I know this is where I roughly want the rotation to finish, the min/max output data from sound keys can be adjusted, so I set it’s output-min to 0, and it’s output-max to 60.

    The sound keys output is then linked to the y rotation of the layer, it’s at this point that I need to apply the exponential curve expression (actually at this link)

    The expression looks like this:

    thisComp.layer(“Dark Gray Solid 2”).effect(“Sound Keys”)(“Output 1”)

    Could I incorporate any kind of exponential curve in to this expression, even if it’s a rough (approximate curve) it would help a lot and I could work the shape to the new curves no problem.

    Secondly, do I have to use keyframes? this was my initial thought, but I really want to avoid using them if I can, how would I go about this, or are keyframes the best approach?

    Sorry, I realise this is a lot of a headache.

    EDD: Oh btw, these exponential curves are the solution I found most effective at keeping the shape within the comp bounds, don’t know if you remember that, but it was a problem you helped me with previously, without these exponential curves applied (particularly on the layers scale) the shape over shoots the edges of the comp by twice it’s width at least, I found that they’re about the only way I can keep the shape in the comp window.

    Coda – musical selections; in film, the ending or last section of a film (often wordless).

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