PyGGB(test): palette de couleur et opacité

# 12/08/2023 from random import* import time #from math import* # background: A=Point(-100,-100, is_visible=False) B=Point(100,-100, is_visible=False) background=Polygon(A,B,4,opacity=1,color=[0,0,0]) #colors: #rgb(216, 211, 205) #rgb(174, 163, 157) #rgb(65, 156, 159) #rgb(75, 83, 96) #rgb(193, 29, 4) #rgb(246, 139, 71) #palette: lcol=[[216/255, 211/255, 205/255],[174/255, 163/255, 157/255],[65/255, 156/255, 159/255],[75/255, 83/255, 96/255],[193/255, 29/255, 4/255],[246/255, 139/255, 71/255]] #tichkness: lt =0 def motif(n,m): for i in range(n): for j in range(m): r=random() col=choice(lcol) if r<0.25 : l=[Point(i,j,is_visible=False),Point(i+1,j,is_visible=False),Point(i+1,j+1,is_visible=False)] s=Polygon(Point(i,j,is_visible=False),Point(i+1+1,j,is_visible=False),4,color=col,opacity=random(),line_thickness=lt) col=choice(lcol) l=[Point(-i,j,is_visible=False),Point(-(i+1),j,is_visible=False),Point(-(i+1),j+1,is_visible=False)] s=Polygon(Point(-i,j,is_visible=False),Point(-(i+1),j,is_visible=False),4,color=col,opacity=random(),line_thickness=lt) col=choice(lcol) l=[Point(i,-j,is_visible=False),Point(i+1,-j,is_visible=False),Point(i+1,-(j+1),is_visible=False)] s=Polygon(Point(i,-j,is_visible=False),Point(i+1,-j,is_visible=False),4,color=col,opacity=random(),line_thickness=lt) col=choice(lcol) l=[Point(-i,-j,is_visible=False),Point(-(i+1),-j,is_visible=False),Point(-(i+1),-(j+1),is_visible=False)] s=Polygon(Point(-i,-j,is_visible=False),Point(-(i+1),-j,is_visible=False),4,color=col,opacity=random(),line_thickness=lt) elif r<0.5 : l=[Point(i,j,is_visible=False),Point(i,j+1,is_visible=False),Point(i+1,j,is_visible=False)] #s=Polygon(l,color=col,opacity=1,line_thickness=0) c=Circle(Point((2*i+1)/2,(2*j+1)/2,is_visible=False),random()*2,color=col,opacity=random(),line_thickness=lt) col=choice(lcol) l=[Point(-i,j,is_visible=False),Point(-i,j+1,is_visible=False),Point(-(i+1),j,is_visible=False)] #s=Polygon(l,color=col,opacity=1,line_thickness=0) c=Circle(Point(-(2*i+1)/2,(2*j+1)/2,is_visible=False),1,color=col,opacity=random(),line_thickness=lt) col=choice(lcol) l=[Point(i,-j,is_visible=False),Point(i,-(j+1),is_visible=False),Point(i+1,-j,is_visible=False)] #s=Polygon(l,color=col,opacity=1,line_thickness=0) c=Circle(Point((2*i+1)/2,-(2*j+1)/2,is_visible=False),random(),color=col,opacity=random(),line_thickness=lt) col=choice(lcol) l=[Point(-i,-j,is_visible=False),Point(-i,-(j+1),is_visible=False),Point(-(i+1),-j,is_visible=False)] #s=Polygon(l,color=col,opacity=1,line_thickness=0) c=Circle(Point(-(2*i+1)/2,-(2*j+1)/2,is_visible=False),random()*1.5,color=col,opacity=random(),line_thickness=lt) elif r<0.75 : l=[Point(i+1,j,is_visible=False),Point(i+1,j+1,is_visible=False),Point(i,j+1,is_visible=False)] s=Polygon(l,color=col,opacity=random(),line_thickness=lt) col=choice(lcol) l=[Point(-(i+1),j,is_visible=False),Point(-(i+1),j+1,is_visible=False),Point(-i,j+1,is_visible=False)] s=Polygon(l,color=col,opacity=random(),line_thickness=lt) col=choice(lcol) l=[Point(i+1,-j,is_visible=False),Point(i+1,-(j+1),is_visible=False),Point(i,-(j+1),is_visible=False)] s=Polygon(l,color=col,opacity=random(),line_thickness=lt) col=choice(lcol) l=[Point(-(i+1),-j,is_visible=False),Point(-(i+1),-(j+1),is_visible=False),Point(-i,-(j+1),is_visible=False)] s=Polygon(l,color=col,opacity=random(),line_thickness=lt) else: l=[Point(i,j,is_visible=False),Point(i,j+1,is_visible=False),Point(i+1,j+1,is_visible=False)] s=Polygon(l,color=col,opacity=random(),line_thickness=lt) col=choice(lcol) l=[Point(-i,j,is_visible=False),Point(-i,j+1,is_visible=False),Point(-(i+1),(j+1),is_visible=False)] s=Polygon(l,color=col,opacity=random(),line_thickness=lt) col=choice(lcol) l=[Point(i,-j,is_visible=False),Point(i,-(j+1),is_visible=False),Point(i+1,-(j+1),is_visible=False)] s=Polygon(l,color=col,opacity=random(),line_thickness=lt) col=choice(lcol) l=[Point(-i,-j,is_visible=False),Point(-i,-(j+1),is_visible=False),Point(-(i+1),-(j+1),is_visible=False)] s=Polygon(l,color=col,opacity=random(),line_thickness=lt) time.sleep(0.001) motif(10,7)
Image
Image
Image
Image
Image