Tuesday, November 15, 2022

Python Turtle Graphics Drawing - Adobe CC Logo

 Python Turtle Graphics Drawing - Adobe CC Logo

Youtube


Source code:

from turtle import *

red='#DA1F26'

setup(640, 640)
bgcolor('black')
color(red)
up()
fd(160)
down()
lt(90)
begin_fill()
circle(118)
end_fill()
lt(90)
up()
fd(22)
down()
rt(90)
begin_fill()
color('white')
circle(118-22)
end_fill()
lt(90)
up()
fd(22)
down()
rt(90)
begin_fill()
color(red)
circle(118-44)
end_fill()
up()
lt(90)
fd(76)
lt(90)
fd(18)
lt(180)
down()
begin_fill()
circle(100)
end_fill()
lt(90)
up()
fd(100)
rt(180-45)
fd(11)
lt(90)
color('white')
down()
begin_fill()
fd(3)
circle(11,180)
fd(62)
lt(90)
fd(22)
lt(90)
fd(59)
end_fill()
up()
lt(90)
fd(11)
lt(135)
fd(102)
lt(90)
fd(18)
lt(180)
fd(74)
down()
begin_fill()
fd(22)
lt(90)
circle(96,-45)
lt(90)
fd(22)
rt(90)
circle(74,45)
end_fill()
up()
lt(90)
fd(74)
lt(90)
fd(102)
lt(90)
fd(18)
fd(56)
fd(22)
lt(90)
down()
begin_fill()
circle(78,-(180+45))
bk(45)
circle(11,-180)
lt(180)
fd(45)
circle(56,180+45+10)
rt(53)
fd(31)
end_fill()
up()
hideturtle()

done()

Python Turtle Graphics Drawing - Golden Snail

 Python Turtle Graphics Drawing - Golden Snail

Youtube


Source code:

import turtle as t
import colorsys as cs
from math import sin, radians
t.setup(640, 640)
t.tracer(250)
t.bgcolor('black')
t.hideturtle()

for i in range(1440,0,-1):
    l = 0.5+sin(radians(i+160))*0.2
    t.color(cs.hls_to_rgb(0.090,l,1))
    t.pensize(1+i/200)
    t.circle(i/10)
    t.lt(1)

t.done()

Monday, November 14, 2022

Python Turtle Graphic Design #11

 Python Turtle Graphic Design #11

Youtube


Source code:

import turtle as t
import colorsys as cs

t.setup(640, 640)
t.tracer(50)
t.pensize(0)
t.bgcolor('black')
t.hideturtle()

for i in range(1440,0,-1):
    t.color(cs.hsv_to_rgb(i/720, 1, 1))
    t.begin_fill()
    t.rt(60)
    for j in range(3):
        t.fd(i/5)
        t.lt(120)
    t.lt(60)
    t.end_fill()
    t.lt(1)

t.done()

Wednesday, November 9, 2022

Python Turtle Graphics Drawing - Ubuntu Logo

 Python Turtle Graphics Drawing - Ubuntu Logo

Youtube


Source code:

from turtle import *
setup(640,640)
bgcolor('black')
col = '#DD4814'
R = 280
r = 38.91*R/100
w = 19.25*R/100
r2 = 13.39*R/100
r3 = 5.02*R/100
h = 3.77*R/100
l = 68.62*R/100
color(col)
up()
fd(R)
lt(90)
down()
begin_fill()
circle(R)
end_fill()
up()
color('white')
lt(90)
fd(R-(r+w))
rt(90)
down()
begin_fill()
circle(r+w)
end_fill()
up()
lt(90)
color(col)
fd(w)
rt(90)
down()
begin_fill()
circle(r)
end_fill()
up()
lt(90)
fd(r)
rt(120)
down()
color('white')
for i in range(3):
    up()
    fd(l+r2+r3)
    lt(90)
    down()
    color(col)
    begin_fill()
    circle(r2+r3)
    end_fill()
    up()
    lt(90)
    fd(r3)
    rt(90)
    color('white')
    down()
    begin_fill()
    circle(r2)
    end_fill()
    up()
    color('white')
    lt(90)
    fd(l+r2)
    rt(90)
    down()
    color(col)
    begin_fill()
    fd(h)
    lt(90)
    fd(r+w)
    lt(90)
    fd(h*2)
    lt(90)
    fd(r+w)
    lt(90)
    fd(h)
    end_fill()
    up()
    lt(30)
done()

Tuesday, November 8, 2022

Python Turtle Graphic Design #10

 Python Turtle Graphic Design #10

Youtube


Source code:

import turtle as t
import colorsys as cs

t.setup(640,640)
t.bgcolor('black')
t.tracer(100)
t.hideturtle()
h = 0
for i in range(360,0,-1):
    t.begin_fill()
    t.color(cs.hls_to_rgb(h,0.5,1))
    h+=1/1.6180
    t.circle(i/2)
    t.end_fill()
    t.lt(137.5)
t.done()

Monday, November 7, 2022

Python Turtle Graphics Drawing - Sierpiński Triangle

 Python Turtle Graphics Drawing - SierpiÅ„ski Triangle


Youtube





Source code:
import turtle as t
import colorsys as cs
from math import sqrt

t.setup(640, 640)
t.bgcolor('black')
t.tracer(10)
t.pensize(2)
R = 500

def tri(r,l):
    if l == 0:
        p=t.pos()
        d = sqrt(p[0]**2+p[1]**2)
        t.color(cs.hls_to_rgb(d/300,0.5,1))
        t.down()
        for i in range(3):
            t.fd(r)
            t.lt(120)
        t.up()
    else:
        t.fd(r/2)
        tri(r/2,l-1)
        t.lt(120)
        tri(r/2,l-1)
        t.fd(r/2)
        t.rt(120)
        tri(r/2,l-1)
        t.rt(120)
        t.fd(r/2)
        t.lt(120)

t.hideturtle()
y = sqrt(R**2-(R/2)**2)
t.up()
t.goto(-R/2,-y/2)
tri(R,7)

t.done()

Friday, November 4, 2022

Python Turtle Graphics Drawing - Fractal Tree

 Python Turtle Graphics Drawing - Fractal Tree

Youtube



Source code:

import turtle as t
import colorsys as cs

t.setup(640,640)
t.bgcolor('black')
t.pencolor('white')
t.tracer(50)

t.up()
t.rt(90)
t.fd(150)
t.lt(180)
t.down()

def tree(a1,a2,d):
    if d<0:
        return
    t.color(cs.hls_to_rgb(d/11,0.5,1))
    t.pensize(d+1)
    t.fd(d*6)
    p = t.pos()
    h = t.heading()
    t.lt(a1)
    tree(a1,a2,d-1)
    t.up()
    t.goto(p)
    t.seth(h)
    t.rt(a2)
    t.down()
    tree(a1,a2,d-1)

tree(25,25,11)
t.done()

Thursday, November 3, 2022

Python Turtle Graphic Design #9

 Python Turtle Graphic Design #9

Youtube



Source code:

import turtle as t
import colorsys as cs
from math import sin,cos,radians

t.setup(640,640)
t.bgcolor('black')
t.tracer(5)
t.pensize(1)
t.up()
k=6
r=1
i=0
while True:
    t.color(cs.hls_to_rgb(r/25,0.5,1))
    R = k*r
    a =radians(i)
    x = R*cos(a)+r*cos(R*a)
    y = R*sin(a)-r*sin(R*a)
    t.goto(x,y)
    t.down()
    i+=1
    r+=0.005
    if r>50:
        break
t.done()

Tuesday, November 1, 2022

Python Turtle Graphics Drawing - Golden Ration

 Golden Ration - Python Turtle Graphics

Youtube





Source code:
import turtle as t
t.setup(640,640)
t.bgcolor('white')
G = 1.618
R = 1
t.speed(10)
t.up()
t.fd(115)
t.rt(90)
t.fd(60)
t.rt(90)
t.down()
for i in range(13):
    t.pensize(1)
    t.color('gray')
    for j in range(4):
        t.fd(R)
        t.lt(90)
    t.pensize(2)
    t.color('black')
    t.circle(R,90)
    R *= G
t.done()

Monday, October 31, 2022

Python Turtle Graphic Design #8

 Python Turtle Graphic Design #8

Youtube



Source code:

import turtle as t
import colorsys as cs
t.setup(640,640)
t.bgcolor('black')
t.tracer(100)
t.hideturtle()
N = 5
A = 360/N
t.lt(45)
for i in range(360,0,-1):
    h = (i % N)/N
    l = i/720
    s = 0.5+ i / 720
    t.color(cs.hls_to_rgb(h,l,s))
    t.begin_fill()
    t.circle(i/2,90)
    t.lt(90)
    t.circle(i/2,90)
    t.end_fill()
    t.lt(90+A-0.1)
t.done()

Friday, October 28, 2022

Python Turtle Graphic Design #7

 Python Turtle Graphic Design #7

Youtube




Source code:

import turtle as t
import colorsys as cs

t.setup(640,640)
t.bgcolor('black')
t.tracer(10)
t.pensize(3)
N = 5
S = 2
A = S*360/N
for i in range(360):
    t.color(cs.hls_to_rgb((i%N)/N,0.5,1))
    t.fd(i)
    t.lt(A)

t.done()

Circle Animation with ImGui

 Circle Animation with ImGui for C++ Youtube: Source code: void CircFunc () {     static int nc = 360 ;     double radius = 300 ;     ...