Last active
August 29, 2015 14:23
-
-
Save dokluch/3472bc2bda064992d75c to your computer and use it in GitHub Desktop.
Keyframe accumulator for After Effects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var audioSource = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider"); | |
var step = 1; // step in frames | |
var accum = 0; | |
if(audioSource.numKeys > 0){ | |
var k = 0; | |
if(time >= step*2){ | |
while(k <= time){ | |
if(audioSource.valueAtTime(k) > audioSource.valueAtTime(k - step*thisComp.frameDuration)){ | |
accum+=audioSource.valueAtTime(k)-audioSource.valueAtTime(k - step*thisComp.frameDuration) | |
} | |
k+=step*thisComp.frameDuration; | |
}; | |
}; | |
}; | |
value = accum; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment