Class: Yuki::Animation::MoveSpritePosition

Inherits:
ScalarAnimation show all
Defined in:
docs/01500_Yuki.rb

Overview

Animation resposive of positinning a sprite between two other sprites

Instance Attribute Summary

Attributes inherited from TimedAnimation

#begin_time, #end_time, #parallel_animations, #root, #sub_animation, #time_source

Instance Method Summary collapse

Methods inherited from TimedAnimation

#done?, #in_parallel_of, #parallel_add, #play_before, #resolver=, #update

Constructor Details

#initialize(time_to_process, on, a, b, distortion: :UNICITY_DISTORTION, time_source: :GENERIC_TIME_SOURCE) ⇒ MoveSpritePosition

Create a new ScalarAnimation convert it to another number (between 0 & 1) in order to distord time

Parameters:

  • time_to_process (Float)

    number of seconds (with generic time) to process the animation

  • on (Object)

    object that will receive the property

  • a (Symbol)

    origin sprite position

  • b (Symbol)

    destination sprite position

  • distortion (#call, Symbol) (defaults to: :UNICITY_DISTORTION)

    callable taking one paramater (between 0 & 1) and

  • time_source (#call, Symbol) (defaults to: :GENERIC_TIME_SOURCE)

    callable taking no parameter and giving the current time



1526
1527
# File 'docs/01500_Yuki.rb', line 1526

def initialize(time_to_process, on, a, b, distortion: :UNICITY_DISTORTION, time_source: :GENERIC_TIME_SOURCE)
end

Instance Method Details

#start(begin_offset = 0)

Start the animation (initialize it)

Parameters:

  • begin_offset (Float) (defaults to: 0)

    offset that prevents the animation from starting before now + begin_offset seconds



1530
1531
# File 'docs/01500_Yuki.rb', line 1530

def start(begin_offset = 0)
end

#update_internal(time_factor)

Method you should always overwrite in order to perform the right animation

Parameters:

  • time_factor (Float)

    number between 0 & 1 indicating the progression of the animation



1534
1535
# File 'docs/01500_Yuki.rb', line 1534

def update_internal(time_factor)
end