Import mojo Class Application Extends App Field mx:Int=50 Field my:Int=50 Field sx:Float Field sy:Float Field omx:Int Field omy:Int Field clock:Int Field timer:Int Field once:Bool Method OnCreate() timer=clock-100 SetUpdateRate 25 End Method OnUpdate() clock+=1 End Method OnRender() If MouseDown=True then mx=MouseX my=MouseY clock=0 timer=clock Else If once=False And clock>timer+200 Seed+=Millisecs() mx=Rnd(DeviceWidth) my=Rnd(DeviceHeight) sx=Rnd(-0.02,0.02) sy=Rnd(-0.02,0.02) clock=0 timer=clock End if mx=mx+clock*sx my=my+clock*sy End if If mx<>omx Or my<>omy Then DrawFractal(-2.15,1.6,mx,my) omx=mx omy=my End If End End 'FUNCTIONS---------------------------------------------------------------- Function Main() New Application() End Function DrawFractal(x:Float,y:Float,u:Float,v:Float) u=1-(Float(2)/DeviceWidth*u) v=1-(Float(2)/DeviceHeight*v) u=u*-1 Local px:Int Local py:Int Local s:Float=0.02 Local c:Int Local r:Int Local g:Int Local b:Int Local y0:Float=-y For px=0 To DeviceWidth y=y0 For py=0 To DeviceHeight c=Julia(x,y,u,v) g=Pow(c,1.8) SetColor 0,g,0 DrawPoint px,py y=y+s Next x=x+s Next SetColor 200,200,200 End Function Julia:Int(x1:Float,y1:Float,u:Float,v:Float) Local i:Int Local an:Float Local x0:Float=u Local y0:Float=v Local xn:Float Local yn:Float For i=1 To 500 xn=Pow(x1,2)-Pow(y1,2)+x0 yn=2*x1*y1+y0 an=Sqrt(Pow(xn,2)+Pow(yn,2)) If an>2 Then Return i End If x1=xn y1=yn Next Return i End