I once found such a very cool Audio Visualizer in ShockWave. And I'd like to rewrite it into plain JavaScript with or without using JQuery. Some parts of the code I know how to change but could someone help me with this fragment? Then I will know how to do with other passages.
package fl.motion.easing
{
public class Quadratic
{
public function Quadratic()
{
super();
}
public static function easeIn(param1:Number, param2:Number, param3:Number, param4:Number) : Number
{
return param3 * (param1 = param1 / param4) * param1 + param2;
}
public static function easeOut(param1:Number, param2:Number, param3:Number, param4:Number) : Number
{
return -param3 * (param1 = param1 / param4) * (param1 - 2) + param2;
}
public static function easeInOut(param1:Number, param2:Number, param3:Number, param4:Number) : Number
{
if((param1 = param1 / (param4 / 2)) < 1)
{
return param3 / 2 * param1 * param1 + param2;
}
return -param3 / 2 * (--param1 * (param1 - 2) - 1) + param2;
}
}
}
You cannot convert ActionScript to JavaScript in the case at all, two different languages however the pseudo can be passed along. In the case of JavaScript you may want to look down this route and see what you can do. Reference from
https://developer.mozilla.org/en-US/docs/Web/API/ScriptProcessorNode/onaudioprocess
This is only part of the answer unfortunately. You will actually find that you will need to create events like the one you posted that'll run when certain events take place (up to how you design it).
Javascript is part of it but not all of it, Check out a cool code-pen I found! https://codepen.io/Wpitallo/pen/oNXjPBr