# Following Eyes

**URL:** <https://forum.kirupa.com/t/following-eyes/175533>\
**Category:** contests\
**Created:** [January 15, 2006, 3:27pm UTC](https://forum.kirupa.com/t/following-eyes/175533 "2006-01-15T15:27:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sammo](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/sammo/32/779_2.png) [@Sammo](https://forum.kirupa.com/u/Sammo)\
**Post date:** [January 15, 2006, 3:27pm UTC](https://forum.kirupa.com/t/following-eyes/175533/1 "2006-01-15T15:27:25Z")

</div>

Now this one was a \*\*\*\*\* to get working. But I just love that feeling now it does 🙂

Inspired by [the Google Eye](http://www.google.com/ig/directory?q=eyes)’s avaiable for your personal google page

```auto
Stage.scaleMode = "noScale"; //1
function drawCircle(name, x, y, d, line, colour, fill, par){
	a = _root.createEmptyMovieClip(name,getNextHighestDepth()); //2
	a._x = x, a._y = y, a.parent = par; //3
	a.lineStyle(line,colour,100);//4
	a.moveTo(d,0);//5
	if (fill) a.beginFill(colour, 100);//6
	for(t = 1; t < 360; t++){ //7
		a.lineTo((d+d*.25*Math.sin(t*Math.PI/180))*Math.cos(t*Math.PI/180),(d+d*.25*Math.sin(t*Math.PI/180))*Math.sin(Math.PI/180*t)); //8
	}
}
function mover () {
	c = [_root[this.parent]._x, _root[this.parent]._y+(_root[this.parent]._height/10)]; //9
	r = 51; //10
	xdist = _xmouse-c[0]; //11
	ydist = _ymouse-c[1]; //12
	h = Math.sqrt((xdist*xdist)+(ydist*ydist)); //13
	newx = xdist*r/h; //14
	newy = ydist*r/h; //15
	this._x = (h > r) ? newx+_root[this.parent]._x : _xmouse; //16
	this._y = (h > r) ? newy+_root[this.parent]._y+15 : _ymouse; //17
}
drawCircle("rightEye", 250, 200, 75, 10, 0xBA0B0B, false, null); //18
drawCircle("leftEye", 440, 200, 75, 10, 0xE4AF00, false, null); //19
drawCircle("rightDot", 0, 0, 20, 1, 0x000000, true, "rightEye"); //20
drawCircle("leftDot", 0, 0, 20, 1, 0x000000, true, "leftEye"); //21
rightDot.onEnterFrame = leftDot.onEnterFrame = mover; //22

```

22 lines, correct me if I’m wrong.
