Tuesday, January 24, 2023

Python Turtle Graphics Drawing - PlayStation Logo

 Python Turtle Graphics Drawing - PlayStation Logo

Youtube


Source code:

from turtle import *
from math import atan2,degrees

setup(650,550)

def cbezto(b,c,d):
    a=pos()
    t = 0.0
    while t <= 1.0:
        t3 = t**3
        t2 = t**2
        f1 = -t3+3*t2-3*t+1
        f2 = 3*t3-6*t2+3*t
        f3 = -3*t3+3*t2
        f4 = t3
        x = a[0]*f1 + b[0]*f2 + c[0]*f3 + d[0]*f4
        y = a[1]*f1 + b[1]*f2 + c[1]*f3 + d[1]*f4
        d1 = -3*t2+6*t-3
        d2 = 9*t2-12*t+3
        d3 = -9*t2+6*t
        d4 = 3*t2
        dx = a[0]*d1 + b[0]*d2 + c[0]*d3 + d[0]*d4
        dy = a[1]*d1 + b[1]*d2 + c[1]*d3 + d[1]*d4
        angr = atan2(dy, dx)
        seth(degrees(angr))
        goto(x, y)
        t += 0.05
    goto(d)


up()
lt(108.1)
fd(225.2)
down()
begin_fill()
lt(161.9)
fd(399)
lt(72.7)
fd(94.3)
lt(107.3)
fd(338)
cbezto((22,155),(56,150),(56,113))
rt(5.5)
fd(137)
cbezto((129,-55),(163,-8),(156,70))
cbezto((150,152),(81,170),(57,179))
cbezto((15,194),(-36,208),(-70,214))
end_fill()

up()
lt(117)
fd(384.8)
down()
begin_fill()
rt(16.2)
fd(52)
lt(109.8)
fd(109)
cbezto((210.5,-143),(284.5,-129),(276.5,-95))
cbezto((269,-70),(194.5,-49.5),(140,-50))
cbezto((98.5,-49.5),(55,-61),(37.5,-67.5))
lt(71)
fd(54.5)
lt(109.7)
fd(95)
cbezto((157.5,-77.5),(198,-81.5),(197,-93))
cbezto((196.5,-102),(167.5,-108.5),(138,-119.5))
rt(0.1)
fd(106.8)
end_fill()

up()
rt(65.5)
fd(179.3)
down()
begin_fill()
lt(135.8)
fd(52.5)
rt(70.4)
fd(68.5)
cbezto((-174,-111.5),(-203,-117),(-192.5,-128.5))
cbezto((-179,-137.5),(-144.5,-135),(-124.5,-126))
rt(1.3)
fd(39.4)
rt(110)
fd(47)
rt(79.4)
circle(-301.2,20.8)
cbezto((-232,-152.5),(-275,-142),(-277,-116))
cbezto((-279,-92),(-229.5,-78),(-170,-56.5))
lt(0.1)
fd(87.6)
end_fill()

up()
rt(44.8)
fd(387.2)
down()
lt(115.1)
pensize(3.5)
circle(19.5)
up()

fnt=('Arial',24,'bold')
color('black')
goto(243.5,-210)
write('R',font=fnt,align='center')

hideturtle()
done()

No comments:

Post a Comment

Python Turtle Graphics Drawing - Gigabyte

 Python Turtle Graphics Drawing - Gigabyte Youtube Source code: from turtle import * setup ( 600 , 600 ) color ( '#2D68AE' ) up (...