You are here: Re: I'm Starting To Think It's Just Not Possible. « All PHP « IT news, forums, messages
Re: I'm Starting To Think It's Just Not Possible.

Posted by Jeckyl on 02/06/07 11:31

I can't get to a server to upload a SWI or SWF .. but if you put this script
on your shape, you'll get some nice floating...

>>
onLoad() {
//
// easing
ease = 0.99;
//
// no movement to start with
movetox = _x;
movetoy = _y;
//
// we have two points following a semi-random
// path, and position the object at midpoint
// rotating based on angle between the points
//
// random start position
tx1 = random()*360; // starting time for x
ty1 = random()*360; // starting time for y
tx2 = random()*360; // starting time for x
ty2 = random()*360; // starting time for y
//
// limits for movement
dx = 23; // how far can it move sideways
dy = 17; // how far can it move up and down
//
// speed of mvement
vx = 5; // how fast does it move in x
vy = 3; // how fast does it move in y
//
// position of our two points
x = _x; // starting y
y = _y; // starting y
//
// how much rotation
a = 0.15; // smaller means less rotation
}
onEnterFrame() {
//
// move the two points
xnew1 = x-_width/2 + dx*sindeg(tx1);
ynew1 = y + dy*sindeg(ty1);
xnew2 = x+_width/2 + dx*sindeg(tx2);
ynew2 = y + dy*sindeg(ty2);
//
// object is at midpoint
_x = (xnew1+xnew2)/2;
_y = (ynew1+ynew2)/2;
//
// rotate based on angle between
_rotation = atan2deg(ynew2-ynew1,xnew2-xnew1)*a;
//
// randomness
tx1 += vx*(0.5+random()*0.5);
ty1 += vy*(0.5+random()*0.5);
tx2 += vx*(0.5+random()*0.5);
ty2 += vy*(0.5+random()*0.5);
//
// ease movement
x = movetox-ease*(movetox-x);
y = movetoy-ease*(movetoy-y);
}
>>

NOTE .. if you set movetox and movetoy to some other value, then the object
with this script will flaot its way over there
--
Jeckyl

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация