Class: Yuki::Animation::TimedAnimation

Inherits:
Object
  • Object
show all
Includes:
Yuki::AnimationMixin
Defined in:
docs/4_Systems_005_Animation.rb

Overview

Class calculating time offset for animation.

Instance Attribute Summary collapse

Attributes included from Yuki::AnimationMixin

#player, #resolver

Instance Method Summary collapse

Methods included from Yuki::AnimationMixin

#begin_offset_for_next_animation

Constructor Details

#initialize(time_to_process, distortion = :UNICITY_DISTORTION, time_source = :SCENE_TIME_SOURCE) ⇒ TimedAnimation

Create a new TimedAnimation

Parameters:

  • time_to_process (Float) —

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

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

    callable taking one paramater (between 0 & 1) and convert it to another number (between 0 & 1) in order to distord time

  • time_source (#call, Symbol) (defaults to: :SCENE_TIME_SOURCE) —

    callable taking no parameter and giving the current time



227
228
# File 'docs/4_Systems_005_Animation.rb', line 227

def initialize(time_to_process, distortion = :UNICITY_DISTORTION, time_source = :SCENE_TIME_SOURCE)
end

Instance Attribute Details

#begin_time ⇒ Time? (readonly)

Get the begin time of the animation (if started)

Returns:

  • (Time, nil)


215
216
217
# File 'docs/4_Systems_005_Animation.rb', line 215

def begin_time
  @begin_time
end

#end_time ⇒ Time? (readonly)

Get the end time of the animation (if started)

Returns:

  • (Time, nil)


218
219
220
# File 'docs/4_Systems_005_Animation.rb', line 218

def end_time
  @end_time
end

#time_source ⇒ #call? (readonly)

Get the time source of the animation (if started)

Returns:

  • (#call, nil)


221
222
223
# File 'docs/4_Systems_005_Animation.rb', line 221

def time_source
  @time_source
end

Instance Method Details

#done? ⇒ Boolean

Note:

should always be called after start

Indicate if the animation is done

Returns:

  • (Boolean)


237
238
# File 'docs/4_Systems_005_Animation.rb', line 237

def done?
end

#duration ⇒ Float

Get the animation duration in seconds

Returns:

  • (Float)


257
258
# File 'docs/4_Systems_005_Animation.rb', line 257

def duration
end

#parallel_add(other) Also known as: <<, |, parallel_play

Deprecated.

You should use a variant of Player for animation orchestration



246
247
# File 'docs/4_Systems_005_Animation.rb', line 246

def parallel_add(other)
end

#play_before(other) Also known as: >

Deprecated.

You should use a variant of Player for animation orchestration



252
253
# File 'docs/4_Systems_005_Animation.rb', line 252

def play_before(other)
end

#start(begin_offset = 0) ⇒ self

Start the animation (initialize it)

Parameters:

  • begin_offset (Float) (defaults to: 0) —

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

Returns:

  • (self)


232
233
# File 'docs/4_Systems_005_Animation.rb', line 232

def start(begin_offset = 0)
end

#update ⇒ self

Note:

should always be called after start

Update the animation internal time and call update_internal with a parameter between 0 & 1 indicating the progression of the animation

Returns:

  • (self)


243
244
# File 'docs/4_Systems_005_Animation.rb', line 243

def update
end