Although I haven't seen cherry blossoms , But I can use it Python Yes turtle Library draw one , It's a long time to run , It depends on the performance of your computer , The better the performance
The effect is as follows :
It looks too ugly , But the source code is here :
from turtle import * from random import * from math import * def tree(n,l): pd(
)# Write # Shadow effect t = cos(radians(heading()+45))/8+0.25 pencolor(t,t,t) pensize(n/3)
forward(l)# Draw branches if n>0: b = random()*15+10 # Right branch deflection angle c = random()*15+10 # Left branch deflection angle d
= l*(random()*0.25+0.7) # Length of next branch # Turn right at an angle , Draw right branch right(b) tree(n-1,d) # Turn left at an angle , Draw left branch
left(b+c) tree(n-1,d) # Turn back right(c) else: # Draw leaves right(90) n=cos(radians(heading(
)-45))/4+0.5 pencolor(n,n*0.8,n*0.8) circle(3) left(90) # add to 0.3 Falling leaves if(random()
>0.7): pu() # Fall t = heading() an = -40 +random()*40 setheading(an) dis = int(800
*random()*0.5 + 400*random()*0.3 + 200*random()*0.2) forward(dis) setheading(t)
# Draw leaves pd() right(90) n = cos(radians(heading()-45))/4+0.5 pencolor(n*0.5+0.5,0.4+
n*0.4,0.4+n*0.4) circle(2) left(90) pu() # return t=heading() setheading(an) backward
(dis) setheading(t) pu() backward(l)# return bgcolor(0.5,0.5,0.5)# Background color ht()# hide turtle
speed(10)# speed 1-10 gradual ,0 Fastest tracer(0,0) pu()# pen-up backward(100) left(90)# Turn left 90 degree pu()
# pen-up backward(300)# back off 300 tree(12,100)# recursion 7 layer done()
Technology