logo_carre_tournants.py

Created by laurent-cortot

Created on February 21, 2020

825 Bytes

Carré c x c avec carré qui suis le contour

Commence par une ligne de n carrés


from kandinsky import *
import time

nbCarre = 10 # nombre de carré sur la ligne
eC = 10 # espace entre les carrés
# détermine la taille du carré pour remplir la ligne
x = 0 # colle aux bords
tC = (320 - (eC - 1)*nbCarre) // nbCarre
# se place au centre de l'écran
y = (220 - tC) // 2

# affiche le dégradé de nbCarré
for i in range(nbCarre):
  fill_rect(x+i*(tC+eC),y,tC,tC,color(255//(nbCarre-i),255//(nbCarre-i),255//(nbCarre-i)))

# Lancement de l'animation
Lx = [x+i*(tC+eC) for i in range(nbCarre)]
Lc = [ 255 for i in range(nbCarre)]

# Place le motif de base
Lc[0]=128
Lc[1]=0

"""
nbTour = 20
while nbTour > 0:
  for i in range(nbCarre):
    fill_rect(Lx[i],y,tC,tC,color(Lc[i],Lc[i],Lc[i]))
  Lc.append(Lc[0])
  Lc=list(Lc[1:nbCarre])
  time.sleep(0.2)
  nbTour = nbTour - 1

"""

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.