# Blink-effect with setInterval

**URL:** <https://forum.kirupa.com/t/blink-effect-with-setinterval/110036>\
**Category:** Uncategorized\
**Created:** [May 11, 2004, 9:44pm UTC](https://forum.kirupa.com/t/blink-effect-with-setinterval/110036 "2004-05-11T21:44:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Danneman](https://avatars.discourse-cdn.com/v4/letter/d/b19c9b/32.png) [@Danneman](https://forum.kirupa.com/u/Danneman)\
**Post date:** [May 11, 2004, 9:44pm UTC](https://forum.kirupa.com/t/blink-effect-with-setinterval/110036/1 "2004-05-11T21:44:36Z")

</div>

I wanted to do a simple blinking-effect for my animations, and put this code into the eyes:

```auto

var timeDelay = 2000;
setFrameTimer = function(){
	if ( (Math.random(1)*100) > 90 ) {
		blink();
	}
}
setInterval (setFrameTimer, timeDelay);

```

Nice and easy, right, giving the eyes a 10 percent chance of blinking every two seconds.

Well, it works nicely in the beginning. But then, after a while, the blinking increases until finally the animations are blinking constantly.

Whyyyy? It just shouldnt happen, right?
