Log in

No account? Create an account
Happy Valentine's Day, Hazel! - Rotten Circuits — LiveJournal
February 14th, 2010
08:49 am


Previous Entry Share Next Entry
Happy Valentine's Day, Hazel!

(4 comments | Leave a comment)

[User Picture]
Date:February 21st, 2010 01:16 pm (UTC)

Re: cooool

Hi! I have no Russian at all, so I'm relying on Google Translate, but I'm glad you found it interesting :)

The pattern of hearts is a complex rotation along the surface of a sphere. each heart is positioned using the same set of rotations, but at different progressions - so they all travel along the same path, but some are much slower than others.

The rotation is applied to the heart using the centre of the sphere (the stationary heart) as a pivot, so that they travel along the surface. It is a rotation about the world axes x, y and z, with different factors for each - if I remember right it is (time * rotation * 0.5) for x, 1.0 for y and 1.5 for z.

So, the each heart position is:

rotate offsetFromCentre through x by (time * speedOfFrontHeart * 0.5 * (indexOfThisHeart / numberOfHearts);
rotate offsetFromCentre through y by (time * speedOfFrontHeart * 1.0 * (indexOfThisHeart / numberOfHearts);
rotate offsetFromCentre through z by (time * speedOfFrontHeart * 1.5 * (indexOfThisHeart / numberOfHearts);

As the calculation is linear, it doesn't cost any more later in the application than at the start - the limiting factor, instead, is the number of hearts and the complexity of the heart mesh.
Powered by LiveJournal.com