t=time-n*index; if (time>n*index){ y=720*Math.abs(Math.cos(2*(t)*Math.PI))*Math.exp(-(t)*0.7); } else{ y=0 } value-[0,y];