# Path: spyral/animation.py
# class Animation(object):
#     """
#     Creates an animation on *property*, with the specified
#     *easing*, to last *duration* in seconds.
# 
#     The following example shows a Sprite with an animation that will linearly
#     change its 'x' property from 0 to 100 over 2 seconds.::
# 
#         from spyral import Sprite, Animation, easing
#         ...
#         my_sprite = Sprite(my_scene)
#         my_animation = Animation('x', easing.Linear(0, 100), 2.0)
#         my_sprite.animate(my_animation)
# 
#     Animations can be appended one after another with the `+`
#     operator, and can be run in parallel with the `&` operator.
# 
#     >>> from spyral import Animation, easing
#     >>> first  = Animation('x', easing.Linear(0, 100), 2.0)
#     >>> second = Animation('y', easing.Linear(0, 100), 2.0)
#     # Sequential animations
#     >>> right_angle = first + second
#     # Parallel animations
#     >>> diagonal = first & second
# 
#     :param property: The property of the sprite to change (e.g., 'x')
#     :type property: :class:`string`
#     :param easing: The easing (rate of change) of the property.
#     :type easing: :class:`Easing <spyral.Easing>`
#     :param duration: How many seconds to play the animation
#     :type duration: :class:`float`
#     :param absolute: (**Unimplemented?**) Whether to position this relative
#                      to the sprite's offset, or to absolutely position it on the
#                      screen.
#     :type absolute: :class:`boolean`
#     :param shift: How much to offset the animation (a number if the property is
#                   scalar, a :class:`Vec2D <spyral.Vec2D>` if the property is
#                   "pos", and None if there is no offset.
#     :type shift: None, a :class:`Vec2D <spyral.Vec2D>`, or a number
#     :param loop: Whether to loop indefinitely
#     :type loop: :class:`boolean`
#     """
# 
#     def __init__(self, property,
#                  easing,
#                  duration=1.0,
#                  absolute=True,
#                  shift=None,
#                  loop=False
#                  ):
#         # Idea: These easings could be used for camera control
#         # at some point. Everything should work pretty much the same.
#         self.absolute = absolute
#         self.property = property
#         self.easing = easing
#         self.duration = duration
#         self.loop = loop
#         self.properties = set((property,))
#         self._shift = shift
# 
#     def evaluate(self, sprite, progress):
#         """
#         For a given *sprite*, complete *progress*'s worth of this animation.
#         Basically, complete a step of the animation. Returns a dictionary
#         representing the changed property and its new value, e.g.:
#         :code:`{"x": 100}`. Typically, you will use the sprite's animate function instead of calling
#         this directly.
# 
#         :param sprite: The Sprite that will be manipulated.
#         :type sprite: :class:`Sprite <spyral.Sprite>`
#         :param float progress: The amount of progress to make on this animation.
#         :rtype: :class:`dict`
#         """
#         progress = progress / self.duration
#         value = self.easing(sprite, progress)
#         if self._shift is not None:
#             if self.property == 'pos':
#                 value = (value[0] + self._shift[0],
#                          value[1] + self._shift[1])
#             else:
#                 value = value + self._shift
#         return {self.property: value}
# 
#     def __and__(self, second):
#         return MultiAnimation(self, second)
# 
#     def __iand__(self, second):
#         return MultiAnimation(self, second)
# 
#     def __add__(self, second):
#         return SequentialAnimation(self, second)
# 
#     def __iadd__(self, second):
#         return SequentialAnimation(self, second)
# 
# class DelayAnimation(Animation):
#     """
#     Animation which performs no actions. Useful for lining up appended
#     and parallel animations so that things run at the right times.
#     """
#     def __init__(self, duration=1.0):
#         self.absolute = False
#         self.properties = set([])
#         self.duration = duration
#         self.loop = False
# 
#     def evaluate(self, sprite, progress):
#         return {}


    import _path
import spyral
import spyral.easing as easing
import math
import itertools
from spyral.animation import Animation, DelayAnimation
try:
except NameError:
    pass

SIZE = (480, 480)
BG_COLOR = (0, 0, 0)
RED = (255, 0, 0)
YELLOW = (255, 255, 0)
BLUE = (0, 255, 0)
GREEN = (0, 0, 255)
SMALL = (40, 40)

go_down = spyral.Animation('y', easing.Linear(0, 80), duration = 1.0)
go_down += spyral.Animation('y', easing.Linear(80, 0), duration = 1.0)
go_down.loop = True


# Path: spyral/animation.py
# class Animation(object):
#     """
#     Creates an animation on *property*, with the specified
#     *easing*, to last *duration* in seconds.
# 
#     The following example shows a Sprite with an animation that will linearly
#     change its 'x' property from 0 to 100 over 2 seconds.::
# 
#         from spyral import Sprite, Animation, easing
#         ...
#         my_sprite = Sprite(my_scene)
#         my_animation = Animation('x', easing.Linear(0, 100), 2.0)
#         my_sprite.animate(my_animation)
# 
#     Animations can be appended one after another with the `+`
#     operator, and can be run in parallel with the `&` operator.
# 
#     >>> from spyral import Animation, easing
#     >>> first  = Animation('x', easing.Linear(0, 100), 2.0)
#     >>> second = Animation('y', easing.Linear(0, 100), 2.0)
#     # Sequential animations
#     >>> right_angle = first + second
#     # Parallel animations
#     >>> diagonal = first & second
# 
#     :param property: The property of the sprite to change (e.g., 'x')
#     :type property: :class:`string`
#     :param easing: The easing (rate of change) of the property.
#     :type easing: :class:`Easing <spyral.Easing>`
#     :param duration: How many seconds to play the animation
#     :type duration: :class:`float`
#     :param absolute: (**Unimplemented?**) Whether to position this relative
#                      to the sprite's offset, or to absolutely position it on the
#                      screen.
#     :type absolute: :class:`boolean`
#     :param shift: How much to offset the animation (a number if the property is
#                   scalar, a :class:`Vec2D <spyral.Vec2D>` if the property is
#                   "pos", and None if there is no offset.
#     :type shift: None, a :class:`Vec2D <spyral.Vec2D>`, or a number
#     :param loop: Whether to loop indefinitely
#     :type loop: :class:`boolean`
#     """
# 
#     def __init__(self, property,
#                  easing,
#                  duration=1.0,
#                  absolute=True,
#                  shift=None,
#                  loop=False
#                  ):
#         # Idea: These easings could be used for camera control
#         # at some point. Everything should work pretty much the same.
#         self.absolute = absolute
#         self.property = property
#         self.easing = easing
#         self.duration = duration
#         self.loop = loop
#         self.properties = set((property,))
#         self._shift = shift
# 
#     def evaluate(self, sprite, progress):
#         """
#         For a given *sprite*, complete *progress*'s worth of this animation.
#         Basically, complete a step of the animation. Returns a dictionary
#         representing the changed property and its new value, e.g.:
#         :code:`{"x": 100}`. Typically, you will use the sprite's animate function instead of calling
#         this directly.
# 
#         :param sprite: The Sprite that will be manipulated.
#         :type sprite: :class:`Sprite <spyral.Sprite>`
#         :param float progress: The amount of progress to make on this animation.
#         :rtype: :class:`dict`
#         """
#         progress = progress / self.duration
#         value = self.easing(sprite, progress)
#         if self._shift is not None:
#             if self.property == 'pos':
#                 value = (value[0] + self._shift[0],
#                          value[1] + self._shift[1])
#             else:
#                 value = value + self._shift
#         return {self.property: value}
# 
#     def __and__(self, second):
#         return MultiAnimation(self, second)
# 
#     def __iand__(self, second):
#         return MultiAnimation(self, second)
# 
#     def __add__(self, second):
#         return SequentialAnimation(self, second)
# 
#     def __iadd__(self, second):
#         return SequentialAnimation(self, second)
# 
# class DelayAnimation(Animation):
#     """
#     Animation which performs no actions. Useful for lining up appended
#     and parallel animations so that things run at the right times.
#     """
#     def __init__(self, duration=1.0):
#         self.absolute = False
#         self.properties = set([])
#         self.duration = duration
#         self.loop = False
# 
#     def evaluate(self, sprite, progress):
#         return {}


# Path: examples/view.py
    import _path
import spyral
import spyral.easing as easing
import math
import itertools
from spyral.animation import Animation, DelayAnimation

try:
except NameError:
    pass

SIZE = (480, 480)
BG_COLOR = (0, 0, 0)
RED = (255, 0, 0)
YELLOW = (255, 255, 0)
BLUE = (0, 255, 0)
GREEN = (0, 0, 255)
SMALL = (40, 40)

go_down = spyral.Animation('y', easing.Linear(0, 80), duration = 1.0)
go_down += spyral.Animation('y', easing.Linear(80, 0), duration = 1.0)
go_down.loop = True


go_up = spyral.Animation('y', easing.Linear(160, 0), duration = 2.0)