Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > General > Animation and Effects

Reply
 
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average. Display Modes
Old 10-22-2008, 04:53 PM   #1
alan_bourne
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...

Code:
onClipEvent(load){
var my_x:Number = 0;
var my_y:Number = 0;
}

onClipEvent(enterframe){
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
pixelwit
village halfwit
 
pixelwit's Avatar
 
Join Date: Jul 2001
Location: USA, PA
Posts: 3,330
Default

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

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

Hi,

Thankx for this code,

Ive used the code

onClipEvent(load){
var my_x:Number = 0;
var my_y:Number = 0;
}

onClipEvent(enterframe){
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
Reply


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 11:54 AM
actionscript floating problem monkeyboy ActionScript 2.0 3 12-08-2004 08:36 PM
Pixel masking effect using actionscript? reedy2k ActionScript 1.0 (and below) 7 03-24-2004 06:08 PM
tweening effect with actionscript? devon ActionScript 1.0 (and below) 20 12-15-2002 02:43 PM


All times are GMT. The time now is 03:27 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, 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.