Creative Communities of the World Forums

The peer to peer support community for media production professionals.

  • Posted by Ross Mcdowell on April 17, 2008 at 1:54 pm

    Hello everyone,

    I had a look around online, but cant seem to find the solution to this problem.
    Is there any way if I have say a slider control which is has different values over time, that I can get the sum of all those values for the entire composition?

    If anybody has any idea it would be much appreciated.

    Thanks

    Ross

    Ross McDowell
    Animation Student

    Ross Mcdowell replied 18 years, 1 month ago 2 Members · 10 Replies
  • 10 Replies
  • Dan Ebberts

    April 17, 2008 at 5:17 pm

    Do you mean that you want the sum of all the keyframe values, or that you want the value integrated (once per frame?) over the duration of the comp?

    Dan

  • Ross Mcdowell

    April 17, 2008 at 5:45 pm

    Hi Dan,

    I mean that on say the first frame of the composition I want to create a value that looks forward at all of the frames and gives me the sum of all those values.
    Basically I have a scale value that I want to attach to an audio level, but I dont want the scale value to fluctuate with the audio, but rather to gradually ease itself to a value of 100.
    I’ll write it as I would say it:

    c = current audio level + all values before it.
    s = sum of all values for entire comp.

    scale = linear(c,0,s,0,100);

    I am not sure how much sense this makes…but am hoping u’ll get a slight idea of what im trying to do. if you have any alternate ways of doing such a thing, I would love to hear them.

    Thank you for your quick reply 🙂

    Ross

    Ross McDowell
    Animation Student

  • Dan Ebberts

    April 17, 2008 at 6:03 pm

    Try it: 🙂

    audioLev = thisComp.layer(“Audio Amplitude”).effect(“Both Channels”)(“Slider”);
    t = 0;
    s = 0;
    c = 0;
    while (t < thisComp.duration){ s += audioLev.valueAtTime(t); if (t <= time) c += audioLev.valueAtTime(t); t += thisComp.frameDuration; } scale = linear(c,0,s,[0,0],[100,100]); Dan

  • Ross Mcdowell

    April 17, 2008 at 6:51 pm

    Ah Dan,

    You sir are a genius, it worked perfectly 🙂

    I do however have a new problem. If it is ok with you I will make use of this opportunity and ask you.

    Basically the scale was taking place on an object which is scaling away from the camera into the distance. If you imagine a 3D plane lying horizontally in the 3D space, the anchor point has been moved so that the scale causes the plane to scale away from the camera. The scaling only takes place on the y scale value.

    Sorry if this isnt making sense, but hopefully the next part will.

    The new problem I am having is that as the scale is happening away from the camera, the first jumps in audio appear far more extreme than the later jumps, obviously because the scale is further away in the distance the scale looks smaller.

    Can you think of any way that the current script or the scale percentage value can be edited to create a more “exponential scaling” motion?

    Sorry again if this isnt making a whole lot of sense…

    Thanks

    Ross

    Ross McDowell
    Animation Student

  • Dan Ebberts

    April 17, 2008 at 8:11 pm

    If it’s 3D, instead of scaling away, why not just have it move away?

    Dan

  • Ross Mcdowell

    April 17, 2008 at 8:23 pm

    Hi Dan,

    That just happens to be what I am trying this very moment 🙂

    I moved your script (and made it so that it ends up with only one parameter) into an slider control, and considered this value to be a percentage of distance moved.

    Then I entered in the start position of the layer and the final position of the layer and using the percentage value from your script, it moves the layer to where it should be depending on the audio:

    ———————————————————

    u0 = 718.0; v0 = 85.5;
    u1 = 540.0; v1 = -3214.75
    u2 = 1573.0; v2 = 99918.0;

    percent = thisComp.layer(“controls”).effect(“percent”)(“Slider”)

    x = u0-(u0 – v0)/(100/(linear(percent,0,100,0,100)));
    y = u1-(u1 – v1)/(100/(linear(percent,0,100,0,100)));
    z = u2-(u2 – v2)/(100/(linear(percent,0,100,0,100)));

    [x,y,z]

    ———————————————————

    I know its not the best way to go about things, but at the moment it is getting the same results as with the previous scaling method.

    However I am still having the problem that the motion at the start is far more extreme than it is at the end, because it is so far away from the camera.

    I have tried some ideas to try and give the value changes at the end of the sequence more worth than those at the beginning to try and compensate…but nothing at the moment seems to be working….

    If you have any ideas I would love to hear them 🙂

    Thank you

    Ross

    Ross McDowell
    Animation Student

  • Dan Ebberts

    April 17, 2008 at 8:31 pm

    Try changing linear() to easeIn() and see how much that helps.

    Dan

  • Dan Ebberts

    April 17, 2008 at 8:44 pm

    Actually you can even stack easeIn() to make the behavior more extreme, like this:

    easeIn(easeIn(easeIn(c,0,s,0,100),0,100,0,100),0,100,0,100);

    If you turn the graph on, you’ll see the effect of each additional easeIn().

    Dan

  • Ross Mcdowell

    April 17, 2008 at 8:46 pm

    Awesome awesome.

    Am trying that now, will let you know how it turns out.

    Thank you for your quick replies 🙂

    Ross

    Ross McDowell
    Animation Student

  • Ross Mcdowell

    April 17, 2008 at 9:24 pm

    Hi Dan,

    It worked perfectly again, I got the nice ease in that I was after. However for aesthetic purposes, I reduced the distance in the z direction, and found I liked it better without the ease in the end. But thank you so much, I learnt quite a bit today 🙂

    Thanks again

    Ross

    Ross McDowell
    Animation Student

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