illusion1.py

Created by schraf

Created on August 15, 2022

409 Bytes

Comme le prouve le script, les 2 rectangles vont à la même vitesse, c’est uniquement la couleur du fond qui change !

🖥 Visiter ma chaine Youtube Maths-info

M’offrir un café


from kandinsky import fill_rect as fr
from time import sleep

COUL = ((3,30,220),(255,242,0))

def bandes(v):
 for c in range(32):
  g = v[c%2]
  fr(10*c,0,10,222,(g,g,g))

def rect(x,y,c):
 g = v[x//2%2]
 fr(5*x,10*y,5,20,(g,g,g))
 fr(40+5*x,10*y,5,20,c)

while True:
 for v in ((160,114),(255,0)):
  bandes(v)  
  for x in range(64):
   rect(x,5,COUL[0])
   rect(x,14,COUL[1])
   sleep(.06)

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 <a href="https://www.numworks.com/legal/cookies-policy/">cookies policy</a>.