picture rotating function?

does anyone know if there is a way of turning an image with javascript?

so far I haven't used wysiwyg's, but I have a picture I want to rotate in a circular motion. As a single frame the picture is 6k, as a rotating .gif its about 32k, but flash can do it using only 7k. I would rather not have Flash do it as unless I do the whole site in flash I cannot use the layer elsewhere as it is to be transparente.

Dont find that in the books!!!

nice one Beetle, the books I've got are of little help now, nothing like that in them!! The equation above was -picsize not -(picsize/2) its abit jumpy, but I think thats to do with it not being able to be placed at eg 3.7px?

Cheers

Re: found this worked......

Quote:

*Originally posted by Markdidj *

**using the matrix, I added positioning like...**

position=62*sintheta*costheta

if (position<0) { position=0-position }

document.all.oDiv.style.top=100-position

document.all.oDiv.style.left=100-position

as the pic was 150px square, the 62 was calculated as..

(square-root of (picsize*picsize)+(picsize*picsize))-(picsize/2)

I guess it does only work if the picture is a square?

Hmmm, (square-root of (picsize*picsize)+(picsize*picsize))-(picsize/2) isn't 62, it's 137 :confused:

Isn't (Math.sqrt(2) - 1) * picsize better? :)

A comment on using the pow() method; I think a*a is more efficient than Math.pow(a, 2) (but, of course, if b = 1000, it's better to use Math.pow(a, 1000) than a*a*a*...)

BTW, does anyone know of a Matrix object in javascript?

An object you could use like this...

var A = new Matrix(3, 3); // create a 3x3 matrix

A.value(2,1) = 100; // assign a value to row 2, col 1

C = A.multiply(B); // the matrix C is now AxB

var d = C.det(); // calculate the determinant of C

etc...