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, #parallel_animations, #root, #sub_animation, #time_source

Instance Method Summary collapse

Methods inherited from TimedAnimation

#done?, #in_parallel_of, #parallel_add, #play_before, #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>)


506
507
# File 'docs/4_Systems_005_Animation.rb', line 506

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



514
515
# File 'docs/4_Systems_005_Animation.rb', line 514

def resolver=(resolver)
end

#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



510
511
# File 'docs/4_Systems_005_Animation.rb', line 510

def start(begin_offset = 0)
end