Microsoft Small Basic

Program Listing:
Embed this in your website
GraphicsWindow.BackgroundColor = "Black"
em=13
eyeball_num = em*em
mpi=math.pi
rad=60
irisrad = 12

For i = 1 to eyeball_num
  GraphicsWindow.BrushColor = "Yellow"
  iris[i] = Shapes.AddEllipse(irisrad,irisrad)
  posX[i] =Math.Remainder(i-1,em)*42+50
  posY[i] = Math.Floor ((i-1)/em)*42+50
  Shapes.Move(iris[i],posX[i]-irisrad/2,posY[i]-irisrad/2)
EndFor

rr=rad/2-irisrad/2
ir2=irisrad/2

While ("True")

  For g = 1 To eyeball_num
    getAngle()
    distfromcenter[g] = Math.SquareRoot(Math.Abs(dx[g]*dx[g]+dy[g]*dy[g]))
    yOnEyeball[g] = Math.Sin(angle[g])*Math.Min(rr,distfromcenter[g]/3)
    xOnEyeball[g] = Math.Cos(angle[g])*Math.Min(rr,distfromcenter[g]/3)
    Shapes.Move(iris[g],posX[g]+xOnEyeball[g]-ir2,posY[g]+yOnEyeball[g]-ir2)
    zf= 100/distfromcenter[g]
    If zf>1.5 then
      zf=1.5
    endif
    Shapes.Zoom(iris[g],zf,zf)
  EndFor

EndWhile

Sub getAngle
  dx[g] = GraphicsWindow.MouseX - posX[g]
  dy[g] = GraphicsWindow.MouseY - posY[g]
  If (dx[g] = 0) Then
    angle[g] = Math.Pi/2
    If (dy[g] < 0) Then
      angle[g] = -angle[g]
    EndIf
  Else
    angle[g] = Math.ArcTan(dy[g]/dx[g])
  EndIf
  If (dx[g] < 0) Then
    angle[g] = angle[g]+mPi
  EndIf
EndSub

Copyright (c) Microsoft Corporation. All rights reserved.