Des motifs de Truchet "cercles" point par point #pyggb

Image
import time from random import* from math import* nc = 20 nl = 20 A = Point(-2,-2,is_visible=False) B = Point(nc+2,-2,is_visible=False) fond = Polygon(A,B,4) fond.color="white" fond.opacity=1 for b in range(0,nl,2): for a in range(0,nc,2): r =randint(1,2) if r== 2: for i in range(0,11): x=0 y=0 Point(x+cos(i*pi/(2*10))+a,y+sin(i*pi/(2*10))+b,color=[abs(sin(i*pi/(2*10))),0,1]) Point(2-(x+cos(i*pi/(2*10)))+a,2-(y+sin(i*pi/(2*10)))+b,color=[abs(sin(i*pi/(2*10))),0,1]) time.sleep(0.001) else: for i in range(0,11): x=0 y=0 Point(2-(x+cos(i*pi/(2*10)))+a,y+sin(i*pi/(2*10))+b,color=[abs(sin(i*pi/(2*10))),0,1]) Point(2-(2-(x+cos(i*pi/(2*10))))+a,2-(y+sin(i*pi/(2*10)))+b,color=[abs(sin(i*pi/(2*10))),0,1]) time.sleep(0.001)
Image