This is a discussion on "revolving objects" within the Flash & Multimedia Forum section. This forum, and the thread "revolving objects are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
revolving objects
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
revolving objects
I've tried a couple of forums now with no success. Im no expert but at the same time im sure this is achievable...cos I've seen stuff like this before?!
I have a bit of script which is revolving an object around a central point. All i want is it to be interactive...so that when i move the mouse to the right side of the screen for example (ie. "_xmouse > 250") it orbits right and if i move left it roates left. It would be even cooler if it acted with acceleration... so it moved faster and then obviously slower as you moved the mouse towards the center of the stage. It's just a case of using the variable "speed" and the _xpositon i guess??. But i dont know how cos Im no pro. any help would be hugely appreciated. Thanks... This is the script I have so far... onClipEvent(load){ y=100; speed=5; radius=100; xcenter=250; ycenter=200; zcenter=100; angle=0; fl=150; } onClipEvent(enterFrame){ z=Math.sin(angle*Math.PI/180)*radius+zcenter; scale=fl/(fl+z); x=Math.cos(angle*Math.PI/180)*radius; _x=x*scale+xcenter; _y=y*scale+ycenter; _xscale= _yscale = scale*100; angle+=speed; if(angle>359){ angle-=360; } } |
|
|
|
#2
|
|||
|
|||
|
Ok, It took me a little bit of thinking, but I think you'll like the solution as it only requires 2 new lines of code and the deletion of another!
And it does speed up further away from the object:
All I did was multiply the mouse x co-ordinate by this number. 0.05 seems about right to me. 0.1 is ridiculously fast and 0.01 is sluggish. Hope this is exactly what you wanted |
|
#3
|
|||
|
|||
|
your an absolute star! thankyou very much...
|
|
#4
|
|||
|
|||
|
Just had a play around ..and its almost what i wanted. I appreciate your help but i realised that what i actually want in the long run is probably going to be more difficult. What this will do eventually is have 4 objects all rotating together. I do this by changing the angle variable on each object. So i divided 360 by 4 to give them equal distances apart. So I have 90, 180, 270 and 360. This works as i had it before but with the new code they will understandably all move into the same position once the mouse enters the center of the screen thus covering each other.
So now im confused as to how i would keep them seperate and at the same time have each of them a button so you can click on them individually. I know im proably asking a bit to much but just thought you might might be able to shed some light on the matter?! Anyway..thanks again Sirkent. You've been a great help. |
|
#5
|
|||
|
|||
|
Could you post your new code so I can have a headstart on this one? I've been very busy at the moment so I can't quite be bothered to get as far as you - But i'd be happy to try and figure out what the problem is.
|
|
#6
|
|||
|
|||
|
cool.
sorry when i said new code i meant your new code. Basicly if you just have four objects on the stage with the original code i had on each one, but change the angle on each one. ie. angle = 90 angle =180 angle =270 angle =360. notice how this works...they all move together but are seperated. i want to acheive this but with your new code! as it is they all move to the same position overlapping each other? does this make sense...? |
![]() |
| Tags |
| revolving, objects |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to move the objects in HTML? | virenparmar | Website Planning | 1 | Jun 2nd, 2008 08:47 |
| Moving Objects (Not sure if this goes here) | Stormraven | JavaScript Forum | 9 | May 11th, 2008 21:59 |
| Sending objects to the client | QuikFrozen | ASP.NET Forum | 5 | Apr 18th, 2007 14:20 |
| XML to dataset, bussiness objects | johndahl | ASP.NET Forum | 0 | Apr 28th, 2006 05:46 |
| Internet Explorer & objects... HELP! | brittny | Web Page Design | 7 | Jul 6th, 2005 23:29 |