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)

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>.