from helper import *
import math

d = 1
def update(stat, elapsed):
    s = Stat(stat)
    
    if s.data.type == AnimatorType.Round:
        s.data.raccum += s.data.rspeed * elapsed
        
        global d
        if s.data.radius > 2.0 or s.data.radius < -2.0:
            d = -d
        s.data.radius += 0.005 * d
        
        s.position.x = s.data.center.x + s.data.radius * math.cos(s.data.raccum)
        s.position.y = s.data.center.y + s.data.radius * math.sin(s.data.raccum)
        s.position.z = s.data.center.z
    
    s.direction.z += 0.2
    s.direction.y = math.pi / 2
    return s.toTuple()
