# Pendulum with Random Wind Effect

**URL:** <https://forum.kirupa.com/t/pendulum-with-random-wind-effect/203521>\
**Category:** flash\
**Created:** [October 11, 2006, 6:48pm UTC](https://forum.kirupa.com/t/pendulum-with-random-wind-effect/203521 "2006-10-11T18:48:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rockyreasoner](https://avatars.discourse-cdn.com/v4/letter/r/d6d6ee/32.png) [@rockyreasoner](https://forum.kirupa.com/u/rockyreasoner)\
**Post date:** [October 11, 2006, 6:48pm UTC](https://forum.kirupa.com/t/pendulum-with-random-wind-effect/203521/1 "2006-10-11T18:48:17Z")

</div>

Hi… I have a pendulum that swings infinitely.  
I’d like to set the maximum angle to a random amount to give it a sort of “blown by a random wind” effect. I’m not great at code, so I can’t figure out how to randomize “maxAngle” without making the animation jerky. Does anyone have any ideas on how to do this? Here is my code and FLA…

```auto
onClipEvent (load) {
	P = 1;
	maxAngle = 30;
	numOsc = 1;
}
onClipEvent (enterFrame) {
	setProperty(_parent.Pend, _rotation, (((Math.sin (numOsc*P))*(Math.pow (1, P))))*maxAngle);
	P = P + 0.16;
	}

```
