PDA

View Full Version : Hover/levitate effect?


wu-tang
12-13-2006, 12:35 AM
I am working on an interface that needs to have a hover/levitate effect. The idea is (the ball) starts out sitting on the grass then as you move over it and closer to the center point it levitates or hovers off the ground.

I'm try to make it levitate higher based on how close the mouse is to the center point

Interface here (the current effect is done with a tween, but they want something more active) - http://www.justintense.com/mlb07/

I've played around with some code but cannot get the effect i'm after.

Anyone have any ideas?

Here is a sample of the code I just started to work on.

Noct
12-14-2006, 07:15 PM
If mouse is in range of ball,
get mouse x/y.
as mouse moves, get new value.
compare new value to last, to calculate the difference.
Move ball's x/y to match that difference.
Stop the ball if you go past certain coordinates.
Return the ball to origin if you leave range.

wu-tang
12-14-2006, 07:37 PM
That sounds like solid logic:D

I ended up just using the tween class to give more relaistic movement, but thanks for the input.