My New Spiral Procedural Drawing Program on Small Basic
I coded a new procedural drawing program which is using Fibonacci series with two seeds and draws spirals accordingly.
The code takes gray tone, thickness of pen, step length and angle change from the Fibonacci series having these two seeds.
This is the spiral created from the seeds 30 and 9:
And this is the AI stylized image from above image:
Small Basic Link of the code>> http://smallbasic.com/program/?ZKDV668.000
Here is the code itself :
zero:GraphicsWindow.Width=1024
GraphicsWindow.Height=768
Turtle.Speed = 10
radius=1
angle=0
'Input seeds and step length
' angle seed 1:
TextWindow.Show()
TextWindow.WriteLine("Enter Angle Seed #1 (0-255):")
don1=TextWindow.Read()
' angle seed 2:
TextWindow.WriteLine("Enter Angle Seed #2 (0-255):")
don2=TextWindow.Read()
renk1= MATH.Remainder(don2,256)
pw= MATH.Remainder(don2+don1,8)
TextWindow.Hide()
turtle.X=GraphicsWindow.width/2
turtle.Y=GraphicsWindow.Height/2
GraphicsWindow.Title="Turtle the procedural painter | seeds: "+don1+" & "+don2
'procedure loop
start:
GraphicsWindow.PenColor = GraphicsWindow.GetColorFromRGB(renk1,renk1,renk1)
GraphicsWindow.PenWidth=pw
Turtle.Move((radius)/GraphicsWindow.Width*16)
don=don1+don2
don1=don2
don2= math.Remainder(don,256)
renk1= MATH.Remainder(renk1+don2/64,128)
radius=radius+don2/GraphicsWindow.Width
Turtle.Turn(don2/GraphicsWindow.Width*32)
pw=MATH.Remainder(pw+(don2/128-1),4)
GraphicsWindow.KeyDown=keyy
Goto start
Sub keyy
Turtle.Hide()
GraphicsWindow.ShowMessage("I hid!","Message from Turtle")
Turtle.Show()
EndSub
Have fun...
Comments
Post a Comment