PDA

View Full Version : actionscript to simulate a floating effect


webguy
03-06-2005, 12:24 AM
Hola,
trying to figure out how to do a floating effect with actionscript, make it look like something is floating on water - not rough seas just gentley bobbing around. I'm actually heading out the door to go get the project I was working on - if anyone has seen anything like what I am talking about, or know a general shortcut I'd like to hear about it.

webg

dpzimney
03-06-2005, 01:53 AM
What about trying something with a sin wave? If you could set up a function that increments to the actual path that you want the closest thing (mathematically) that I can think of that would imitate something floating on water would be sin or cos . . . but of course this is just an idea. :rolleyes:

dpzimney
03-06-2005, 02:07 AM
Okay, I'm thinking something more like this:


var my_x:Number = 0;
var my_y:Number = 0;

onClipEvent(enterframe){
my_x += 0.1;
my_y += 0.2;

_x = Math.sin(my_x);
_y = Math.cos(my_y);
}


Still just a thought . . . but a bit clearer.