Skip to content

Commit

Permalink
Added Code For Fidget Spinner.
Browse files Browse the repository at this point in the history
This Is Python Code For Fidget Spinner Colored As BLUE,YELLOW,RED.
  • Loading branch information
CODEMASTERSTACK authored Oct 12, 2022
1 parent e2c11b4 commit b5c7dbd
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions Fidget Spinner
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@

from turtle import *

state= {'turn':0 }

def spin():
clear()

angle = state['turn']/10

right(angle)
forward(100)
dot(130, 'blue')

back(100)

"second dot"
right(120)
forward(100)
dot(130, 'yellow')
back(100)

"third dot"
right(120)
forward(100)
dot(130, 'red')
back(100)
right(120)

update()

def animate():
if state['turn']>0:
state['turn']-=1

spin()
ontimer(animate, 20)

def flick():
state['turn']+=40 #acceleration of spinner

setup(600, 400, 370, 0)
bgcolor("black")

tracer(False)

width(60)
color("orange")

onkey(flick,'space')

listen()
animate()
done()

0 comments on commit b5c7dbd

Please sign in to comment.