# Random interval for wave effect

**URL:** <https://forum.kirupa.com/t/random-interval-for-wave-effect/190362>\
**Category:** Uncategorized\
**Created:** [June 11, 2006, 12:27am UTC](https://forum.kirupa.com/t/random-interval-for-wave-effect/190362 "2006-06-11T00:27:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![logikal2](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/logikal2/32/1143_2.png) [@logikal2](https://forum.kirupa.com/u/logikal2)\
**Post date:** [June 11, 2006, 12:27am UTC](https://forum.kirupa.com/t/random-interval-for-wave-effect/190362/1 "2006-06-11T00:27:31Z")

</div>

Hey,

I made a semi-sinewave effect (view attachment) and it works fine with one exception. I want for it to wave on random intervals (from 1-15 seconds) instead of continuously, but I can’t get it working right. Here’s the code:

[AS]  
pts = 5;  
sine = 0;  
apart = Stage.width/pts;  
bottom = Stage.height;  
wlen = bottom/2;  
\_root.onEnterFrame = function() {  
this.clear();  
this.beginFill(0x0066CC, 100);  
this.moveTo(0, bottom);  
for (i=1; i\<=pts; i++) {  
px = apart_i;  
py = wlen+Math.sin(sine_wlen)\*12;  
this.lineTo(px, py);  
sine += 0.082;  
}  
this.lineTo(px, bottom);  
this.lineTo(0, bottom);  
this.endFill();  
};  
[/AS]  
Anyone know how to fix this?

Thanks in advance :ne:
