citation1.py

Created by schraf

Created on September 21, 2022

2.29 KB


import turtle
from kandinsky import fill_rect
from time import sleep

tt = turtle
tt.color((240,)*3)
tt.hideturtle()
tt.speed(0)

az=['@R[?OXM_N`OaQ_R]R_SaTaU`W]Y[','@SA?PKNUL_N]QXRYT[UaOcL`Q]Z\\',
'@R\\?SRJ^ObUcW^Y[','@Q[?NVI^MaQd]DZAWAR[Pi','@O[?S\\SYSXNULkX\\',
'@R\\?T[WTVRRRKuOwSvPiLgObU^[[','@UZ?OXNaP`RaS^T\\TgQuLvGrS`[[',
'@TA?PKOWLbN^QZRYTXS_U_V`Y\\Z[','@QV?QWQWQX@PZ?NeRcW[',
'@UW?UWVYVY@U[?SgOtKtDqT^]\\','@TA?PKNXKcN_OZSXXYQ]O]P`Vb[\\',
'@QP?UNXBXATAQZOg','@LV?IhJcOXQeQ\\TZWcY]\\[','@NW?N[L`McO`PZSYVfV`Z[',
'@N\\?M`O`PaT_RZQYOYOZOZR`V\\X\\','@PS?N_LlKwLhQVVXYZU`SbN_X\\\\\\',
'@VZ?QWP^Q`T`T]U\\TcSlSq','@PX?O\\O_ObP^Q[SYT\\V\\X[','@XV?QYP\\P]P_WaWcVeRhOg',
'@SA?OQMaJq@AL?ALfKfK','@MZ?L^L`MaP_Q\\SYQ_RaTbW`Y^Z[','@MX?L^LeMePdR[TVU]Y[Z[',
'@LX?K\\KaLbO`O]P[PkW^UWW\\Y\\[[','@NY?RaV_Y[@TW?TWNaNa','@PZ?O_PaQaT`T\\VYSoOyKzFuUb\\\\',
'@M\\?OXTXTXUZR\\P^\\^QrMtFqU^[\\','@N[?S[SWQWMYN`QaU`V]X[@RR?RRPUPU']

def move(x,y):tt.goto(x-160,110-y)

def coord(a,b,c,d,t):
 return a*(1-t)**3+3*b*t*(1-t)**2+3*c*t*t*(1-t)+d*t**3

def bezier(x,y,l,cc):
 tt.pendown()
 t=0
 for i in range(11):
  u=coord(l[0],l[2],l[4],l[6],t)
  v=coord(l[1],l[3],l[5],l[7],t)
  move(x+cc*u,y+cc*v)
  t+=.1

def f(l):return [ord(c) - 65 for c in l]  

def lettre(x,y,svg,cc):
 i = 0
 while i<len(svg):
  if svg[i]=="@":
    l=[svg[i+1],svg[i+2]]
    tt.penup()
    move(x+cc*f(l)[0],y+cc*f(l)[1])
    i+=3
  elif svg[i]=="?":i+=1
  else:  
    for j in range(6):l.append(svg[i+j])
    bezier(x,y,f(l),cc)
    l=[svg[i+4],svg[i+5]]
    i+=6

def phrase(x,y,txt,cc=1,ps=2):
 tt.pensize(ps) 
 for i,c in enumerate(txt):
  e=0 
  if i>0:
    if txt[i-1] in 'cghjpsuwyE': e=3 
  if c!=" ":
    if c=='E': c='{'
    lettre(x+cc*(12*i+e),y,az[ord(c)-97],cc)

def eff(s=1):
  if s:sleep(1)
  fill_rect(0,0,320,222,(63,80,63))

eff(0)
phrase(15,10,"les mathEmatiques")
phrase(125,50,"ne sont pas")
phrase(30,90,"une moindre immensitE")
phrase(10,135,"que la mer")
phrase(155, 150, "victor hugo",ps=1)
eff()
phrase(10,30,"je est un autre",1.5)
phrase(60, 140, "arthur rimbaud",ps=1)
eff()
phrase(15, 10, "les yeux sont aveugles")
phrase(80, 60, "il faut chercher")
phrase(120, 110, "avec le coeur")
phrase(35, 165, "antoine de saint exupEry",.8,1)
eff()
phrase(5,0,"je pense",1.7)
phrase(30,65,"donc je suis",1.7)
phrase(60, 160, "renE descartes",ps=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 <a href="https://www.numworks.com/legal/cookies-policy/">cookies policy</a>.