# Trig (wave movement)

**URL:** <https://forum.kirupa.com/t/trig-wave-movement/281085>\
**Category:** flash\
**Created:** [February 4, 2009, 7:26pm UTC](https://forum.kirupa.com/t/trig-wave-movement/281085 "2009-02-04T19:26:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![substance](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@substance](https://forum.kirupa.com/u/substance)\
**Post date:** [February 4, 2009, 7:26pm UTC](https://forum.kirupa.com/t/trig-wave-movement/281085/1 "2009-02-04T19:26:01Z")

</div>

I’m making a basic wave movement pattern using Math.sin and I have the behavior of the movement working, but I cant seem to factor in a custom angle. Here’s what I’m doing:

[http://teamimpulse9.com/CosSin.html](http://teamimpulse9.com/CosSin.html)

This is perfect and works how I want it to, however, instead of moving to the right I want it to move at an angle (from starting position to mouse).

Here’s my code:

```php

			var angleRadians:Number = (angle/180)*Math.PI;
			//var angleOffset:Number = angleBetween(new Point(stage.mouseX,stage.mouseY),new Point(newPosition.x, newPosition.y));
			newPosition.x += 1;
			newPosition.y = Math.sin(angleRadians) * radius;
			circle.graphics.beginFill(0xFF0000);
			circle.graphics.drawCircle(newPosition.x ,newPosition.y,1);											
			angle += curviness;			
			if(radius > 0){
				radius -=.1;				
			}

```

I thought simply adding the angle offset would work, but I cant wrap my head around what is going wrong.
