Skip to content

Instantly share code, notes, and snippets.

@forresto
Last active August 18, 2020 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save forresto/7ac162e0c152a34b0d8d78fd5efce173 to your computer and use it in GitHub Desktop.
Save forresto/7ac162e0c152a34b0d8d78fd5efce173 to your computer and use it in GitHub Desktop.
ae pingpong scripting pseudocode
// Imagined API
import AE from 'ae'
// Assumes playBackwardDuration is less than playForwardDuration
function (clip, playForwardDuration, playBackwardDuration) {
let time = 0;
const edits = []
while (time < clip.clipDuration) {
let playHead = time;
edits.push(AE.edit(playHead, playHead + playForwardDuration, 1));
playHead = playHead + playForwardDuration;
edits.push(AE.edit(playHead, playHead - playBackwardDuration, -1));
playHead = playHead - playBackwardDuration;
time = playHead;
}
return edits;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment