Your formulas are correct, but you need to use the angle in radians instead of degrees:
radians = degrees * (Math.PI/180)
And if you want to rotate it clockwise, note that your angle is -90 degrees instead of 90. Or, consider its 90, but change the formula to:
radians = -degrees * (Math.PI/180)
Edit:
, , :
[6.123233995736766e-17, -1]
, "" . , , , 0. .
:.
var rotateVector = function(vec, ang)
{
ang = -ang * (Math.PI/180);
var cos = Math.cos(ang);
var sin = Math.sin(ang);
return new Array(Math.round(10000*(vec[0] * cos - vec[1] * sin))/10000, Math.round(10000*(vec[0] * sin + vec[1] * cos))/10000);
};
, :
rotateVector([1,0], 90)
:
[0, -1]