Copy link to clipboard
Copied
Hello dear community.
I've seen on Sarif Industries‌ some cool background animations. Especially the background animation where everyting moves in opposite direction the mouse is moving.
So I did want to try doing this kind of animation too. But I don't know how I can do this nor do I know how this kind of animation is called.
I can't code but I do understand programming languages.
*For everyone who doesn't want to go on the linked website*
As said everything is moving in opposite direction the mouse is moving but it seems like the objects only moves in a determinated area and the objects are moving slower as the mouse is moving.
Thank you in advance and have a nice day
stage.addEventListener(onMouseMove, MouseEvent.MOUSE_MOVE);
private function onMouseMove($e:MouseEvent):void
{
_myBG.x = -stage.mouseX;
_myBG.y = -stage.mouseY;
}
You have everything you need in there.
Just tweak the operations to get the desired effect...
Add " * 0.5" to make it move more slowly for instance.
Copy link to clipboard
Copied
stage.addEventListener(onMouseMove, MouseEvent.MOUSE_MOVE);
private function onMouseMove($e:MouseEvent):void
{
_myBG.x = -stage.mouseX;
_myBG.y = -stage.mouseY;
}
You have everything you need in there.
Just tweak the operations to get the desired effect...
Add " * 0.5" to make it move more slowly for instance.
Copy link to clipboard
Copied
Thanks for your help
Copy link to clipboard
Copied
That's a really nice effect.
If you have time, could you please explain how you implement this.
In its simplest form how would I apply this to an object on my stage. I assume it is an action that is applied to a frame/s, but how do I do that.
Keen to learn.
Thanks
EDIT: I've just noticed this is in the Actionscript forum - is it possible to achieve this effect when using HTML5 Canvas?
Copy link to clipboard
Copied
It probably should work for HTML5 Canvas too and I think the HTML5 code isn't much different than the actionscript code above.
But I'm no programmer so I can't really help you with coding.
Copy link to clipboard
Copied
Thanks Blublok.
I'll persevere with it and see if I can get it working.