Copy link to clipboard
Copied
I'm wondering if there is a way to add the values of a property for every frame before the current time indicator?
the relevance to calculus:
I'm wondering if there is a procedural way in after effects to calculate the area under a curve for a property (integrating the function from "time a" to "time b"). for instance, if you had a slider that you keyframed to have a value of 1 for 3 seconds, a value of 10 for 1 second, and again a value of 1 for 3 seconds (with Hold Keyframe on in this example, but not necessarily so in all other instances). after the 7 seconds in the example, the area under the curve (finite integral from "time 0" to "time 7") should have a value of 16 (if i did my math correctly)
if there is a way to do this, will it work on, for instance, a slider with key frames like the one above, with NO Hold Keyframes, and with easy ease applied to the keyframes? essentially, could it work on any property with any shaped curve?
thanks, i hope i didnt confuse people too much with my question
Copy link to clipboard
Copied
Wow, that's an interesting situation. I don't know if there's a way to do it in AE -- I suspect it can't easily be done, if at all -- but I'm more interested in how you'd use this information.
At the moment, the only thing that comes to mind would be calculus training videos, with motion graphics made in AE.
Copy link to clipboard
Copied
really all i need is a way to add the values from each frame of a property before the current time indicator. yeah i havent been havin much luck on it. i did however find a site that has something that could help. for each frame, it looks backwards to the beginning for a certain situation and records how many instances of that situation are. it's above me how it does it, but it seems like it's on the right track.
http://www.motionscript.com/design-guide/audio-count.html
the purpose: i'm looking for a way to achieve this kind of random motion with the wiggle expression.
http://www.youtube.com/watch?v=7c4WYzr30B0&feature=BFa&list=PL3D65D166031E0E2B&lf=plpp
to achieve this i thought i might keyframe the frequency of the wiggle expression. this ran into a problem, because the frequency determines precedurally where on the path the values whould be wiggled. therefore while increasing the frequency, it will appear as if the frequency of the wiggle is much greater than desired. and a more funky thing happens when the frequency decreases. the wiggle will retrace its steps exactly where it came from.
i dont want to keyframe the amplitude on and off because that would mean every time the amplitude =0, the origin of the particle emitter (or whatever you want to have the random motion) would go back to it's original value. i want it to keeps its amplitude, but have a point zoom across the frame while the frequency is high, PAUSE THERE when the frequency is 0, and then resume motion from that point when the frequency is increased again.
i had an apiphony about achieving this. i've tested it on paper and as far as i can tell it will work, but to test it in after effects i need a way to integrate (or simply add all the previous values to find the "area under the curve")
if there's another way to procedurally achieve this kind of random motion, that would be amazing!!! but i still reeeeeeaaaallly would like to figure out this integration thing.
thanks
Copy link to clipboard
Copied
Yes, you will have to use an expression as per Dan's example.
Mylenium
Copy link to clipboard
Copied
do you know where i can learn how to apply dan's expression techniques to the integration effect i'm trying to achieve?
Copy link to clipboard
Copied
This is a simple example that samples every frame:
accum = 0;
for (i = 0; i <= timeToFrames(); i++){
accum += valueAtTime(framesToTime(i))*thisComp.frameDuration;
}
accum
You could have it sample more often to improve the accuracy, but this is probably close enough for most applications.
Dan
Copy link to clipboard
Copied
Thank you Dan! you are a miracle maker!
for my purposes this expression works superbly!!
does your "mastering expressions" guide on motionscript.com explain how to construct expressions such as these? also the expressions in your "expressioneer's design guide" are quite above me. does it go into that? nowhere have i found a place that explains expressions such as "for (i = 0; i <= timeToFrames(); i++)"
Thanks again
Ramzi Rebeiz
Copy link to clipboard
Copied
The for loop is part of core JavaScript. If you're at all serious about this stuff, you need a good JavaScript reference. I like David Flanagan's "JavaScript the Definitive Guide" (it's the most worn book in my library), but there a lot of good references out there.
Dan
Find more inspiration, events, and resources on the new Adobe Community
Explore Now