Class: Yuki::Animation::TimedLoopAnimation

Inherits:
Player show all
Defined in:
docs/4_Systems_005_Animation.rb

Overview

Note:

This kind of animation is not designed for object creation, please refrain from creating objects inside those kind of animations.

Class responsive of making "looped" animation

This class works exactly the same as Player putting aside it's always done and will update its sub/parallel animations. When the loop duration is reached, it restart all the animations with the appropriate offset.

Instance Attribute Summary

Attributes included from Yuki::AnimationMixin

#player, #resolver

Instance Method Summary collapse

Methods inherited from Player

#animation_index, #first_start_time, #last_end_time, #parallel_add, #play, #resolver=, #root

Methods included from Yuki::AnimationMixin

#begin_offset_for_next_animation

Constructor Details

#initialize(time_to_process, animations = nil, parallel = nil, distortion = :UNICITY_DISTORTION, time_source = :SCENE_TIME_SOURCE) ⇒ TimedLoopAnimation

Create a new timed loop animation

Parameters:

  • time_to_process (Float) —

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

  • animations (Array<AnimationMixin>) (defaults to: nil) —

    all the animations to play one after each other

  • parallel (Array<Array<AnimationMixin> | nil> | nil) (defaults to: nil) —

    all the animations to play in parallel

  • 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



286
287
# File 'docs/4_Systems_005_Animation.rb', line 286

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

Instance Method Details

#done? ⇒ Boolean

Check if the animation is done

Returns:

  • (Boolean)


302
303
# File 'docs/4_Systems_005_Animation.rb', line 302

def done?
end

#duration ⇒ Float

Get the animation duration in seconds

Returns:

  • (Float)


298
299
# File 'docs/4_Systems_005_Animation.rb', line 298

def duration
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)


291
292
# File 'docs/4_Systems_005_Animation.rb', line 291

def start(begin_offset = 0)
end

#update

Update the looped animation



294
295
# File 'docs/4_Systems_005_Animation.rb', line 294

def update
end