Mid-term round_dance.py
This is my first post in this blog. I already have this blog since around 4 years ago, but never used. that's because I just follow the trend to create an account when at that time "Blogging/Blogger" terms became so popular. Purpose doing this is to submit my presentation and some individual debugging about this program. Hope this note will help others, at least to know about what round dance is. Let's start... From [1] written that Round Dance is dancing that progresses in a circular pattern, counter-clockwise around the dance floor.Here some step of round dance[2] :
Waltz and Two-Step
| Phase I | Phase II | Phase II (con't) | ||||
| Away and Together | Basketball Turn (Two-Step) | Roll | ||||
| Box | Box, Left Turning | Spin Maneuver | ||||
| Circle Away | Box, Right Turning | Solo Turning Box | ||||
| Pickup | Forward ( or Forward Waltz) | Thru Side Close | ||||
| Recover | Lace | Thru Twinkle | ||||
| Reverse Box | Lunge | Twinkle | ||||
| Waltz Away and Together (Waltz) | Maneuver | Twirl Vine | ||||
| Pivot | Twisty Vine | |||||
| Progressive Box | Wheel | |||||
| Reverse Twirl | ||||||
- Create shape
def create_shape():
#before draw any graphic clear the screen
clearscreen()
bgcolor("gray10")
#Set tracing off to decrease flickering
tracer(False)
#create circle shape
shape("circle")
#set the size of circle when create circle inside circle
f = 0.793402
#degree between one triange to another
phi = 2.064678
#length of the center circle when first initiate and will be increament
#also fix length of each circle around the center circle
s = 5
c = 1
# create compound shape
#it will iterate over the _item array and add the listener to each individual shape
sh = Shape("compound")
"""
this loop will create iterate circle inside circle with different size
"""
for i in range(10):
shapesize(s)
#this will get value of poly shape
p =get_shapepoly()
s *= f
c *= f
tilt(-phi)
#to make several shape with different color
sh.addcomponent(p, (c, 0.35, 1-c), "black")
register_shape("multitri", sh)
# create dancers
shapesize(1)
shape("multitri")
- Create dance
def create_dance():
#this method will Pull the pen up – no drawing when moving
pu()
#set starting point in the center of the screen
setpos(0, -200)
dancers = []
"""
this loop will draw 12 shapes around the center shape
"""
for i in range(180):
# the same with forward() Move the turtle forward 7 point, in the direction the turtle is headed
fd(7)
# rotate turtle -4 degree
tilt(-4)
# turn turtle to left 2 degree
lt(2)
# perform TurtleScreen update, because tracer(false)
update()
if i % 12 == 0:
dancers.append(clone())
# home() : this function will be Move turtle to the origin – coordinates (0,0) – and set its heading to its start-orientation
# to make the center dancer increase its size periodically
home()
# dance
# set true for running
running = True
# when user press any key will stop running (call the stop function)
onkeypress(stop)
listen()
cs = 1
"""
when running is true program will do looping all the dancers
and the center dancer will be increase it shapesize 0.005 in one cycle
and update its size
"""
while running:
ta = -4
"""
this for loop to keep rotate the all the shape
"""
for dancer in dancers:
dancer.fd(7)
dancer.lt(2)
dancer.tilt(ta)
ta = -4 if ta > 0 else 2
#if center shape size still less than 180 the shape will keep increase its size until 180
if cs < 180:
right(4)
shapesize(cs)
cs *= 1.005
update()
return "DONE!"
When we run the program :
(a). Running original program of round_dance.py
(b). Running modified program (just change the shape from triangle to circle)
Here is the full source code of code and a short presentation about round dance.
Here is also the code in Github :
[1] http://en.wikipedia.org/wiki/Round_dance [2] http://www.mssquaredance.com/Steps.htm
.png)


0 komentar: