Example #1
0
def test_rot_center_interval():
    nd = node.Node()
    b = vec2.Vec2(0)
    e = vec2.Vec2(1)
    animation.RotationCenterInterval(nd, 1.0, b, e).play()
    aam = animation.AnimationManager()
    assert nd.traverse() is True
    assert nd.rotation_center == b
    aam.animate(0.5)
    assert nd.traverse() is True
    assert nd.rotation_center == vec2.Vec2(0.5)
    aam.animate(0.5)
    assert nd.traverse() is True
    assert nd.rotation_center == e
    nd.remove()
Example #2
0
def test_rotation_interval():
    nd = node.Node()
    b = 0.0
    e = 180.0
    animation.RotationInterval(nd, 1.0, b, e).play()
    aam = animation.AnimationManager()
    assert nd.traverse() is True
    assert nd.angle == b
    aam.animate(0.5)
    assert nd.traverse() is True
    assert nd.angle == 90.0
    aam.animate(0.5)
    assert nd.traverse() is True
    assert nd.angle == e
    nd.remove()
Example #3
0
def test_pos_interval():
    nd = node.Node()
    b = vec2.Vec2(0)
    e = vec2.Vec2(1)
    animation.PosInterval(nd, 1.0, b, e).play()
    aam = animation.AnimationManager()
    assert nd.traverse() is True
    assert nd.pos == b
    aam.animate(0.5)
    assert nd.traverse() is True
    assert nd.pos == vec2.Vec2(0.5)
    aam.animate(0.5)
    assert nd.traverse() is True
    assert nd.pos == e
    nd.remove()
Example #4
0
def test_depth_animation():
    nd = node.Node()
    b = 1
    e = 11
    animation.DepthAnimation(nd, 10, b, e).play()
    aam = animation.AnimationManager()
    assert nd.traverse() is True
    assert nd.depth == b
    aam.animate(0.5)
    assert nd.traverse() is True
    assert nd.depth == 6
    aam.animate(0.5)
    assert nd.traverse() is True
    assert nd.depth == e
    nd.remove()
Example #5
0
def test_scale_interval():
    nd = node.Node()
    b = 1.0, 2.0
    e = 2.0, 1.0
    nd.scale = b
    animation.ScaleInterval(nd, 1.0, b, e).play()
    aam = animation.AnimationManager()
    assert nd.traverse() is True
    assert nd.scale == b
    aam.animate(0.5)
    assert nd.traverse() is True
    assert nd.scale == (1.5, 1.5)
    aam.animate(0.5)
    assert nd.traverse() is True
    assert nd.scale == e
    nd.remove()
Example #6
0
def test_combined_interval():
    nd = node.Node()
    pb = vec2.Vec2(0)
    pe = vec2.Vec2(1)
    db = 1
    de = 11
    ival = animation.PosInterval(nd, 1.0, pb, pe)
    ival += animation.DepthInterval(nd, 1.0, db, de)
    ival.play()
    aam = animation.AnimationManager()
    assert nd.traverse() is True
    assert nd.pos == pb
    assert nd.depth == db
    aam.animate(0.5)
    assert nd.traverse() is True
    assert nd.pos == vec2.Vec2(0.5)
    assert nd.depth == 6
    aam.animate(0.5)
    assert nd.traverse() is True
    assert nd.pos == pe
    assert nd.depth == de
    nd.remove()