illusion4.py

Created by schraf

Created on August 15, 2022

531 Bytes

Posez votre calculatrice sur la table. Mettez-vous debout, regardez le point noir central puis approchez votre visage de la calculatrice, vous verrez les losanges tourner !

🖥 Visiter ma chaine Youtube Maths-info

M’offrir un café


from kandinsky import fill_rect as fr
from turtle import *
from math import *

fr(0,0,320,222,(180,180,180))
speed(0)
hideturtle()

def go(x, y):
    penup()
    goto(x, y)
    pendown()  

def losange():
  for c in ('white','black'):
    color(c)
    fd(10); rt(70)
    fd(10); rt(110)

def tour(n, r, d):
  for i in range(n):
    a = 2 * i * pi / n 
    go(r * sin(a), r * cos(a))
    setheading(d - i * 360 / n)
    losange()


for (n, r, d) in ((30, 100, 0), (26, 70, 70)):
  tour(n, r, d)

go(0,0)
circle(2)