ball3d.py

Created by schraf

Created on November 02, 2022

252 Bytes

Traduction en Python du script BASIC ci-dessous (“Creative Graphics on the BBC Microcomputer” John Cownie):

Variation

from turtle import *
from math import *
from kandinsky import fill_rect

speed(0)
hideturtle()

fill_rect(0,0,320,222,(0,)*3)

def s(a): return 120 * sin(a / 10)

for a in range(1258):
  x, y = s(a), cos(a / 10) * s(a * .95)
  c = int((x * x + y * y) / 2200)
  pensize(7 - c)
  color(255 - 30 * c, 0, 0)
  goto(x,y)


from turtle import *
from math import *
from kandinsky import fill_rect

speed(0)
hideturtle()
color('orange')
fill_rect(0,0,320,222,(0,)*3)

def s(a): return 105 * sin(a / 10)

for a in range(1258):
  goto(s(a), cos(a / 10) * s(a * .95))