def x(l):
    ellipse(width/2, height/2, l*10, l*10)
    if l > 0:
        x(l-1)
        
def setup():    
    size(500, 500)
    
def draw():
    x( 20 )

the parameter l denotes level like in a loop how many times to execute

    if l > 0:
        x(l-1)

this prevents infinite recursion

next we passed a decreasing argument

the output is :

img

generated using save() in processing

with a little twerking with coords and size you can have:

img2

some twerking with colors :

img3

 

Advertisements