Skip to content

Instantly share code, notes, and snippets.

@mattborn
Created November 18, 2018 21:53
Show Gist options
  • Save mattborn/4581343bc8ff115d4f3a6664fc6f4358 to your computer and use it in GitHub Desktop.
Save mattborn/4581343bc8ff115d4f3a6664fc6f4358 to your computer and use it in GitHub Desktop.
After Effects Visual Beat — Adobe ExtendScript / Javascript
/* colors = ['#00ddcc','#66cc99','#ffcc00','#ff6666']; */
/* colors_rgb = [[0,221,204],[102,204,153],[255,204,0],[255,102,102]]; */
colors_rgba = [[0,0.866666666666667,0.8,1],[0.4,0.8,0.6,1],[1,0.8,0,1],[1,0.4,0.4,1]];
beats_per_minute = 150;
first_beat = 0;
frames_per_second = 1 / thisComp.frameDuration;
current_frame = (time * frames_per_second) - first_beat;
frames_per_beat = 60 * frames_per_second / beats_per_minute;
modulus = (current_frame / frames_per_beat) % 4;
content("Rectangle 1").content("Fill 1").color = colors_rgba[Math.floor(modulus)];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment