hypno pattern experiment

Messing around with shapes and loop, i’ve managed to create an (decently laggy) pattern with python code.

Below is the code used to make it and a picture (of a single frame) from the illusion like pattern i’m experimenting with:

import simplegui
import random
frameWidth = 600
def draw_handler(canvas):
    
    for i in range (1, 3000):
     
        r = random.randint(0,255)
        g = random.randint(0,255)
        b = random.randint(0,255)
        
        lol = random.randint(1,255)
        
        a = random.randint(299,301)
        b = random.randint(299,301)
      
        randRGBColor = "RGB( " + str(r) + "," + str(g) + "," + str(b) + ")"     
        
        x = random.randint(2, frameWidth)
        y = random.randint(2, frameWidth)
        #main cir
        canvas.draw_circle((x, y),600,1, randRGBColor )
        #mid cir
        canvas.draw_circle((a, b),1,lol, randRGBColor)
        #point
        canvas.draw_point((x, y), randRGBColor)
        
        
   
        color= ["White","Pink","Red","Orange","Yellow","Green","Blue"]
        x=0
        y=0
        x2=0
        y2=0
        
        canvas.draw_circle((x,y), 3, 1, "Black",(random.choice(color)))
        canvas.draw_line([x,y], [x2,y2], 5, (random.choice(color)))
        y=(random.randint(1,600))
        x=(random.randint(1,600))
        y2=(random.randint(1,600))
        x2=(random.randint(1,600))

frame = simplegui.create_frame('Testing', 600, 600)
frame.set_canvas_background("Black")
frame.set_draw_handler(draw_handler)
frame.start()

To better understand:

The outer lines are comprised of thin, hollow circles being placed randomly in a given area 3000 times.

The middle circle consists of random thick and thin circles placed in the middle only shifting by 1-4 pixels every time that overlap each other; Creating the illusion. this is also done 3000 times.

The dots are also placed randomly 3000 times.

And all circles and dots randomly colored every time one is printed.

, ,

Leave a Reply

Your email address will not be published. Required fields are marked *