Inspiré par un commentaire de Numworks France
Ce script utilise une technique que j’ai décrite ici
from turtle import * NB = 10 svg = ['M',41,114,'C',50,104,55,107,62,109,32,136,42,163,54,172,57,137,60,110,94,131,86,147,78,149,70,154,70,154,86,121,86,121,'M',8,38,'C',33,58,73,82,86,85,99,88,97,84,109,90,121,96,144,131,151,134,158,137,181,124,187,119,192,114,183,110,184,109,'M',141,63,'C',141,70,140,76,134,80,128,83,103,82,95,79,91,63,130,51,140,38,144,42,146,49,148,55,'M',189,121,'C',193,124,194,129,202,127,210,125,234,109,238,111,241,113,242,129,239,131,237,134,224,139,222,125,209,126,205,145,201,146,198,147,201,137,201,132,'M',248,127,'C',258,125,271,132,281,132,292,131,307,131,311,101] hideturtle() def move(x,y): goto(x-160,110-y) def coord(a,b,c,d,t): return a*(1-t)**3+3*b*t*(1-t)**2+3*t*c*t*(1-t)+d*t**3 def bezier(l): pendown() t = 0 for i in range(NB+1): x = coord(l[0],l[2],l[4],l[6],t) y = coord(l[1],l[3],l[5],l[7],t) move(x,y) t += 1/NB def dessin(svg,c,e): pensize(e) color(c) i = 0 while i<len(svg): if svg[i] == "M": l = [svg[i+1],svg[i+2]] penup() move(l[0], l[1]) i += 3 elif svg[i] == "Z" or svg[i] == "C": i += 1 else: for j in range(6): l.append(svg[i+j]) bezier(l) l = [svg[i+4],svg[i+5]] i += 6 for k in range(10,0,-2): c = 24*k dessin(svg,(c,c,c),k)