Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 10-22-2008, 04:53 PM   #1
Senior Member
Join Date: Feb 2006
Posts: 102
Question Actionscript floating effect

Hi i was wondering if anyone has a neat piece of actionscript that give the illusion that something is floating?

It needs to move left and right and up and down but always stay in the same spot..... if you get me.

I found a nice pice that uses the follwoing code but it eventually the objects fly away...

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

my_x += 0.1;
my_y += 0.1;

this._x =this._x +Math.sin(my_x);
this._y =this._y +Math.cos(my_y);
alan_bourne is offline   Reply With Quote
Old 10-27-2008, 05:41 PM   #2
village halfwit
pixelwit's Avatar
Join Date: Jul 2001
Location: USA, PA
Posts: 3,339

This bobblehead code might help you out. Just set the decay to 1.

There are no answers, only choices.
pixelwit is offline   Reply With Quote
Old 04-11-2012, 08:36 PM   #3
Registered User
Join Date: Apr 2012
Posts: 1


Thankx for this code,

Ive used the code

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

my_x += 0.0;
my_y += .15;

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

but i want to offset the two objects and control speed and distance moved.
could you please suggest some additions
divyasud is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
what actionscript would i use to effect scrollpanes? alymcmorland Components 2 07-03-2006 01:34 PM
Blur Transition Effect - using actionscript - help Kotti ActionScript 2.0 0 03-21-2006 12:54 PM
actionscript floating problem monkeyboy ActionScript 2.0 3 12-08-2004 09:36 PM
Pixel masking effect using actionscript? reedy2k ActionScript 1.0 (and below) 7 03-24-2004 07:08 PM
tweening effect with actionscript? devon ActionScript 1.0 (and below) 20 12-15-2002 03:43 PM

All times are GMT. The time now is 01:48 PM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.