ActionScript 3.0 :: Mouse Rotation/attraction Effect?
Sep 12, 2009
I am trying to create a effect using AS3. The effect is that several arms should rotate towards the mouse, and rotate less when their further away from the mouse cursor.using Math.atan2 to find how much the arm nedd to rotate to point against the mouse, and then substract the distance from the mouse.(look at the following picture) For example, if Math.atan2 returns 100 and the distance from the mouse is 40, the arm would rotate 60. Thats what i thought.But i cant get it to work. I attached the source files if you want to help Note:A blue ring in the source file indicates the distance.
View 2 Replies
Similar Posts:
Aug 25, 2010
is there a way to change the code and create attraction effect instead of push effect?i tried but without success...!
View 1 Replies
Aug 25, 2010
Is there a way to change the code and create attraction effect instead of push effect?
View 0 Replies
Oct 29, 2006
How do I take Object_MC and have it attract towards the mouse cursor within 100px and return to it's point of origin when the mouse is 101px + away from the cursor, all while doing an "elastic" like recoil effect, and going from 50% alpha to 100% over that distance to the mouse?
View 1 Replies
Apr 19, 2011
i create this code but i cant spinning it with mouse (when i hold it)
Code: Select allmthr.addEventListener(Event.ENTER_FRAME,rotate);
function rotate (e:Event)
{[code]....
View 3 Replies
Apr 7, 2009
Is it possible to create a 3D Rotation effect using ActionScript 2?
View 5 Replies
Oct 25, 2011
When you roll over the image there is frontSide to backside animation.It looks like original animation have 'constant rotation perspective' regargless of image position the rotation look exactly the same.I tried to replicate this effect but when I am using standard rotationY image rotation (or rather rotation respective) varies depending on image position
View 2 Replies
Sep 1, 2006
I'm trying to kind of create an effect of 3d with a movie clip that rotates round its centre on all three axis. Is there any way of using just xscale, yscale, and _rotation properties of an image to give this effect (once you know rotation round z axis, y axis and x axis). I know it can be done I just can't get my head round the flipping over. Its ok when its at only one angle like imagine a photo spinning like some spinning doors but as soon as the angle changes is where I'm having problems. This is as far as I've got but its clearly wrong, it shrinks to zero size. Use right up and down arrow keys [URL].
View 4 Replies
Jun 4, 2010
im not exactly sure where to start right now im using a script for dhtml to rotate imaged randomly what i hope to accomplish is background , that will have some type of transition effect and randomly show my images
i have 32 images atm i would like to rotate through i found this and have tried to use it , but not exactly what i want , i need a transitional effect of somekind, and want it to rotate at a given amount of time , say maybe 12seconds[URL]...
View 7 Replies
Apr 17, 2009
i was wondering if theres a way to link the amount and direction of an objects rotation to the mouse position. I want it so if you move the mouse far to the left the object spins fast anticlockwise but if you move it to the center it stops.
View 2 Replies
Aug 15, 2009
I have done the rotation bit, but now i want to limit the rotation but i can't do it
this is my code -
PHP Code:
stage.addEventListener(Event.ENTER_FRAME, moveArm)
function moveArm(e:Event):void
[code].....
View 2 Replies
Nov 14, 2009
I have a whole heap of circles which are user created and they all bounce off one another. Generally it works fine but occasionally two balls join together and sort of .. orbit each other.
my collision code is this: (it's within two loops going through an array of movie clips, where mc1 is the current movie clip in the first loop and mc2 is the current movie clip within the second loop)
ActionScript Code:
dx = mc1._x-mc2._x
dy = mc1._y-mc2._y
[Code].....
View 1 Replies
Feb 1, 2010
How do I rotate an object with the mouse after I have dragged the object with mouse.ssentially, I want to move the object with the mouse and then rotate it with another mouse click. Right now the object is moving and rotating at the sime time.
View 6 Replies
Jul 21, 2009
I want to know if there is a way to determine the rotation of mouse movements flawlessly. this will trace the direction I am going in.
[Code]...
View 2 Replies
May 31, 2011
My goal is to make it so that when the user clicks and drags the disc (whether it be click anywhere on the stage or clicking on the disc itself), the disk will turn according to where the mouse goes.
I've used this tutorial [URL] to make a simple arrow move when the mouse does to test the code and see if it works, and it does. But now i'm trying to figure out how to make it so it will only move when I drag the mouse. I've tried things like "onClipEvent (mouseDown)" and such but they don't drag the clip.
how to get the arrow/disc to drag (and eventually, play a sound, but I will worry about that later),
code on MC:
Code:
onClipEvent (mouseMove) {
x = this._xmouse;
y = this._ymouse*-1;
[Code]....
View 0 Replies
Aug 29, 2009
I've got a very simple AS2 test file here:URL...I have a simple triangle, and it follows the mouse as it moves around.I'd like to get the triangle to change rotation, to follow the mouse, but my so far bodged version doesn't do that very elegantly.I have this AS on the MC that follows the mouse:[code]
View 3 Replies
Nov 8, 2009
I'm not really replacing the mouse cursor exactly. Just placing a custom image of a pointer below it so it will follow the mouse cursor as it moves around the screen. I want this pointer image to move with the mouse and to rotate and point in the direction the mouse is traveling. Simple stuff. The problem is that the rotation of the pointer graphic is not smooth at all. It is jumpy and somewhat erratic particularly at slower mouse speeds. When the mouse is moving quickly the problem seems to go away.
PHP Code:
package {
import flash.display.Sprite;
import flash.events.*;
public class MouseFollower extends Sprite {
private var pointer:Pointer = new Pointer(); // ...a simple triangle mc
[Code] .....
View 2 Replies
Sep 30, 2009
I have a circle wheel i want to rotate and the speed should be based on the mouse position. I also need to have easing in and out.
When the user hovers over the bottom of the circle it will begin to rotate one way and then th top of the circle would make it rotate the other way. The further to the top or bottom they are the quick it spins. It ideally needs to ease in and out when it starts and stops when the user moves the mouse away.
The circle will be the complete movie so 50% top and bottom each for each direction.
View 1 Replies
Aug 6, 2011
The player rotates to the mouse when you click somewhere and moves there. The problem is sometimes when you click on a corner the player rotates towards where you clicked but sometimes starts moving sideways.
View 3 Replies
May 8, 2009
I'm trying to make a movieclip rotate around it's center (this is no problem since the center will never change). The problem that I am having is when I press the movieclip, in let's say the bottomright corner, and move the mouse the movieclip flips to a certain angle depending on my mouseposition. After the weird flip it works fine but it's the initial mouse click that makes the movieclip flip to an angle.I've tried playing around with different values to substract or add the starting angle but eveytime the result is not what i am looking for.Current code:
Code: Select all
package
{
[code].....
View 8 Replies
Jul 21, 2006
how to use trig to rotate a movie clip based on (my_mc._x, my_mc._y) and (_root._xmouse, _root._ymouse)?
View 1 Replies
Jun 14, 2007
I'm trying to make it ease to the spot but it doens't seem like there is a way.
It is jumpy, i would like to it to slowly smooth to the current mouse location. It's going to be used for a touch screen
Heres my current AS:
Code:
stop()
face.onRollOver = function(){
startDrag("mouseTarget", true);
[Code]....
View 1 Replies
May 2, 2009
right now I have a code that rotates an object based on the position of it and the mouse. Thats all great but it sucks for a game, It is way too responsive. What I tried doing is making to rotation var:
[Code]...
after that I made rot2 the direct rotation between the object and the mouse: rot2 = Math.atan2(Ydiff, Xdiff) * 180/Math.PI; //(forgive me if this has spelling errors, as I am writing it //by hand right now) then I make rot effect the object: object.rotation = rot; now that the basics are set up I just need to make a code that compares rot2 and rot, if rot is less than rot2 it adds on to rot, if it is greater, then it will subtract.
(source at bottom) this all works well until you hit the most annoying part, the one i cant figure out how to fix.... basically there is a gap where the numbers go from 180 to -180, so the code flips out, reads this as it is supposed to, but this makes the object rotate a full 360 degrees around instead of just like 2 degrees to bridge the gap. If anyone has insight on this or thinks they might know what to do,
[Code]....
View 3 Replies
Apr 29, 2010
I have this code is AS3
Code:
var xMouse = mouseX;
var yMouse = mouseY;
[Code]...
But unfortunately, the ship does not follow mouse rotation. The ship only rotates with respect to the mouse when you move the ship, not when you move the mouse.
View 1 Replies
Jan 24, 2011
I have researched all over and have found some that "kind of" work, but the coding always has issues with CS3 (my version). I am more proficient in AS2, but would be willing to try AS3 if that is the way to go.I need a script that will allow the user to use their mouse to drag a wheel that will slow down to a stop. Think "Wheel of Fortune" style. Where it stops will trigger an event.
View 4 Replies
Jun 25, 2010
Essentially what I'm trying to do is nearly the same as this: http:[url].......However I'd like to ease/tween the movieclip position and rotation to the mouse position.The main issue I see is trying to get the current movieclip rotation and the target rotation,then tween it cockwise or counterclockwise from current to target.The way a movieclips rotation uses positive and negative numbers throws it off.If you just want to lock the mc rotation to the mouse rotation its fine, but once you try to tween it you run into difficulties. So the end effect would be like if you were to draw imaginary clockwise circles around the object, it should just keep rotating clockwise towards the mouse. Then if you started going counter clockwise it should just keep easing counter clockwise to the mouse.
View 1 Replies
Aug 16, 2005
First off, lemme start by saying that this site is incredibly awesome. Every time I have a problem or wish to learn something in Flash I turn to [URL]. Now for my problem. Have you ever played Madness? You know how, depending on where the mouse is, the hand rotates i.e. points at the mouse's current position? Well, I want to learn how to do that. I've attached a short animation demonstrating what I want to be able to do (the arrow points at the mouse's position, and then gun represents the movie clip that rotates) using a script
View 6 Replies
Nov 30, 2009
I have created a globe that rotates with no problem, but what I am trying to do is to control the direction of the rotation based on the mouse position. For example, if the mouse is to the right of the globe, it rotates towards the right and if the mouse in on the left, the globe rotates left. When the mouse is over the globe, it should stop.
View 1 Replies
Jun 25, 2010
I'd like to ease/tween the movieclip position and rotation to the mouse position.The main issue I see is trying to get the current movieclip rotation and the target rotation, then tween it cockwise or counterclockwise from current to target. The way a movieclips rotation uses positive and negative numbers throws it off. If you just want to lock the mc rotation to the mouse rotation its fine, but once you try to tween it you run into difficulties. So the end effect im looking for would be like if you were to draw imaginary clockwise circles around the object, it should just keep rotating clockwise towards the mouse. Then if you started going counter clockwise it should just keep easing counter clockwise to the mouse.
View 3 Replies
May 9, 2011
i create stage Mouse Rotation Y is complete and i want to put some easing on movieclip this is my code
Code:
import flash.events.Event;
addEventListener(Event.ENTER_FRAME, onEnterFrame);
function onEnterFrame(event:Event):void
{
[Code]...
View 3 Replies