INNER CODE UNIT · Python
move_x
tuangauss/DataScienceProjects · Python/fireworks.py:63
move_x = cos(radians(self.id*360/self.total))*self.initial_speed
move_y = sin(radians(self.id*360/self.total))*self.initial_speed
self.cv.move(self.cid, move_x, move_y)
self.vx = move_x/(float(dt)*1000)
# falling down in projectile motion
elif self.alive():
move_x = cos(radians(self.id*360/self.total))
# we technically don't need to update x, y because move will do the job
self.cv.move(self.cid, self.vx + move_x, self.vy+GRAVITY*dt)
self.vy += GRAVITY*dt
# remove article if it is over the lifespan
elif self.cid is not None:
cv.delete(self.cid)
self.cid = None
# define time frame for expansion