Skip to content

Instantly share code, notes, and snippets.

@notepadwebdev
Last active November 21, 2016 19:28
Show Gist options
  • Save notepadwebdev/75eaa5f14153424d59c3135151f1f133 to your computer and use it in GitHub Desktop.
Save notepadwebdev/75eaa5f14153424d59c3135151f1f133 to your computer and use it in GitHub Desktop.
Animating speaker cone elements based on frequency bin volume data
// bin 3 : ~86 Hz
let percVol = this.dataArray[2] / 255;
TweenLite.to(this.wooferConeOuter, 0.001, {css:{scale: (1 + (percVol * 0.05)) }});
// bin 8 : ~301 Hz
percVol = this.dataArray[7] / 255;
TweenLite.to(this.wooferConeMid, 0.001, {css:{scale: (1 + (percVol * 0.1)) }});
// bin 17 : ~689 Hz
percVol = this.dataArray[16] / 255;
TweenLite.to(this.wooferConeInner, 0.001, {css:{scale: (1 + (percVol * 0.1)) }});
// bin 221 : ~9,500 Hz
percVol = this.dataArray[220] / 255;
TweenLite.to(this.tweeterConeInner, 0.001, {css:{scale: (1 + (percVol * 0.09)) }});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment