OUR PROJECTS AND CODES
OUR CODES AND PROJECTS
At TechAnimnator, we’re constantly pushing the boundaries of technology and animation. We bring creative ideas to life through a series of exciting and innovative projects. Here’s a glimpse of the work we’re proud to showcase:
CREATE a Turtle Design with Python Code! #coding #python #shorts
TURTLE DESIGN PYTHON CODE
MY NAME IS KRISH KAUSHIK TODAY WE WILL GONNA LEARN HOW TO CREATE a Turtle Design with Python Code!
BELOW THERE IS A PYTHON CODE AND LINK OF YOUTUBE VIDEO COPY AND PASTE IT ON YOUR PYTHON COMPLIER
THANKYOU.
YOUTUBE VIDEO LINK-https://youtube.com/shorts/SdtnoWWS7k8?si=pIFrV7SV8B9ppBDJ
DOCUMENT LINK-https://docs.google.com/document/d/1GspeH-HKesKK3VvHJTLjmogl0B_IwHaPGkk7Jk_AQQQ/edit?pli=1&tab=t.0
CODE LINK-
import turtle
import math
import random
# Set up the screen
screen = turtle.Screen()
screen.bgcolor("black")
screen.title("Best Rounded Turtle Animation")
screen.tracer(0) # Manual updates for smooth animation
# Create main turtle
main_turtle = turtle.Turtle()
main_turtle.shape("turtle")
main_turtle.color("lime")
main_turtle.shapesize(2)
main_turtle.speed(0)
# Create drawing turtle for patterns
pattern_turtle = turtle.Turtle()
pattern_turtle.speed(0)
pattern_turtle.hideturtle()
# Colors for circular patterns
colors = ["red", "cyan", "yellow", "purple", "orange", "pink", "white"]
def draw_rotating_circles(angle):
pattern_turtle.clear()
pattern_turtle.penup()
pattern_turtle.goto(0, 0)
pattern_turtle.pendown()
# Draw concentric rotating circles
for i in range(5):
radius = 50 + i * 30
pattern_turtle.pencolor(colors[i % len(colors)])
pattern_turtle.width(2)
pattern_turtle.circle(radius + math.sin(math.radians(angle)) * 20)
pattern_turtle.right(angle)
def move_turtle(angle):
# Move main turtle in a circular path
radius = 150
x = radius * math.cos(math.radians(angle))
y = radius * math.sin(math.radians(angle))
main_turtle.goto(x, y)
main_turtle.setheading(angle) # Rotate turtle to face direction
def draw_orbiting_dots(angle):
# Create small orbiting dots
for i in range(4):
dot_turtle = turtle.Turtle()
dot_turtle.hideturtle()
dot_turtle.shape("circle")
dot_turtle.shapesize(0.5)
dot_turtle.color(colors[i % len(colors)])
dot_radius = 100 + i * 20
dot_x = dot_radius * math.cos(math.radians(angle + i * 90))
dot_y = dot_radius * math.sin(math.radians(angle + i * 90))
dot_turtle.penup()
dot_turtle.goto(dot_x, dot_y)
dot_turtle.showturtle()
angle = 0
def animate():
global angle
pattern_turtle.clear()
draw_rotating_circles(angle)
move_turtle(angle)
draw_orbiting_dots(angle)
angle += 3 # Slower rotation for smoother effect
screen.update()
screen.ontimer(animate, 20) # ~50 fps for smooth animation
# Start animation
animate()
# Keep window open
screen.mainloop()
Comments
Post a Comment