# Light angles from your mouse

**URL:** <https://forum.kirupa.com/t/light-angles-from-your-mouse/13960>\
**Category:** flash\
**Created:** [February 20, 2003, 8:39am UTC](https://forum.kirupa.com/t/light-angles-from-your-mouse/13960 "2003-02-20T08:39:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![circusmidget](https://avatars.discourse-cdn.com/v4/letter/c/e95f7d/32.png) [@circusmidget](https://forum.kirupa.com/u/circusmidget)\
**Post date:** [February 20, 2003, 8:39am UTC](https://forum.kirupa.com/t/light-angles-from-your-mouse/13960/1 "2003-02-20T08:39:08Z")

</div>

Not sure if this is even possible with flash but im looking for a way to make your mouse a source of light emission that changes the way its angled based on the position of your mouse like sun beams. If you have ever tried this and have some tips or even the source code (yes I stoop to any level hehe), I would name my first child after you. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2003, 10:21am UTC](https://forum.kirupa.com/t/light-angles-from-your-mouse/13960/2 "2003-02-20T10:21:18Z")

</div>

Well… If all you need is to get the angle, then it is more likely the math stuff, I guess…

You can get the curent mouse location with \_xmouse and \_ymouse, right??? Store them to the variable…  
Check if the mouse is moving or not by using onMouseMove handler, and give some time and check the last known mouse location… Store them again to the variable…

Now you have the coordinate of the starting position and the ending position, so do the math to get the angle with it… I don’t want to open my old math book, so you do the math… 😛

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2003, 10:43am UTC](https://forum.kirupa.com/t/light-angles-from-your-mouse/13960/3 "2003-02-20T10:43:24Z")

</div>

it depends what you’re lighting. I know Flashkit has a nice file (actually I think its a tutorial) on doing that with faceted edges with a diamond shape thing  
… a quick search brought it up  
[http://www.flashkit.com/tutorials/3D/Lighting-Mr10-678/index.php](http://www.flashkit.com/tutorials/3D/Lighting-Mr10-678/index.php)

should be able to help you out. The menu (circle at the bottom) lets you control the light with your mouse by turning autopath off.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2003, 2:26pm UTC](https://forum.kirupa.com/t/light-angles-from-your-mouse/13960/4 "2003-02-20T14:26:35Z")

</div>

[http://www.robertpenner.com/index2.html](http://www.robertpenner.com/index2.html)

Have a look at the shading fla over there. It might be usefull…
