Class: Yuki::Animation::TimedCommands

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

Overview

Note:

It'll skip all the commands that are not SpriteCreationCommand if it's "too late"

Animation that try to execute all the given command at total_time / n_command * command_index Example :

TimedCommands.new(1,
create_sprite(:main, :star1, SpriteSheet, [1, 3], [:select, 0, 0]),
send_command_to(:star1, :select, 0, 1),
send_command_to(:star1, :select, 0, 2),
)
# Will create the start at 0
# Will set the second cell at 0.33
# Will set the third cell at 0.66

Instance Attribute Summary

Attributes inherited from TimedAnimation

#begin_time, #end_time, #time_source

Attributes included from Yuki::AnimationMixin

#player, #resolver

Instance Method Summary collapse

Methods inherited from TimedAnimation

#done?, #duration, #parallel_add, #play_before, #update

Methods included from Yuki::AnimationMixin

#begin_offset_for_next_animation, #done?, #duration, #update

Constructor Details

#initialize(time_to_process, *animation_commands) ⇒ TimedCommands

Create a new TimedCommands object

Parameters:

  • time_to_process (Float) —

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

  • animation_commands (Array<Command>)


738
739
# File 'docs/4_Systems_005_Animation.rb', line 738

def initialize(time_to_process, *animation_commands)
end

Instance Method Details

#resolver=(resolver)

Define the resolver (and transmit it to all the childs / parallel)

Parameters:

  • resolver (#call) —

    callable that takes 1 parameter and return an object



747
748
# File 'docs/4_Systems_005_Animation.rb', line 747

def resolver=(resolver)
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)


743
744
# File 'docs/4_Systems_005_Animation.rb', line 743

def start(begin_offset = 0)
end