def animated_move(self, x, y, mode=Clutter.AnimationMode.EASE_OUT_CUBIC): self._move_animation = Clutter.Animation(object=self, mode=mode, duration=250) self._move_animation.bind("antler-window-position", (x, y)) timeline = self._move_animation.get_timeline() timeline.start() return self._move_animation
def animated_opacity(self, opacity, mode=Clutter.AnimationMode.EASE_OUT_CUBIC): if opacity == self.get_opacity(): return None if self._opacity_animation is not None: if self._opacity_animation.has_property('opacity'): timeline = self._opacity_animation.get_timeline() timeline.pause() self._opacity_animation.unbind_property('opacity') self._opacity_animation = Clutter.Animation(object=self, mode=mode, duration=100) self._opacity_animation.bind("opacity", opacity) timeline = self._opacity_animation.get_timeline() timeline.start() return self._opacity_animation
def __call__(self, actor, mode, duration, **kwargs): try: animations = self.__objs[actor] except KeyError: animations = {} self.__objs[actor] = animations actor.connect('destroy', self.__destroy) for key, value in kwargs.iteritems(): key = key.replace('_', '-') try: animation = animations[key] animation.unbind_property(key) except KeyError: animation = Clutter.Animation() animation.set_object(actor) animations[key] = animation animation.set_duration(duration) animation.bind(key, value) animation.get_timeline().start()