Module: Yuki::Animation

Defined in:
docs/4_Systems_005_Animation.rb,
docs/5_Battle_20_MoveAnimation.rb

Overview

Module managing animation description and playing

Defined Under Namespace

Modules: Mutant Classes: Anchor, AudioCommand, Command, CompressAnimation, Dim2Animation, Dim2AnimationDiscreet, DiscreetAnimation, Disposable, EllipseAnimation, EqAnimation, EqOffsetAnimation, FallingAnimation, FullyResolvedAnimation, Handler, HealingParticlePlayer, MessageLocked, MoveParticleAnimation, MoveParticleOffsetAnimation, MoveParticleOnSprite, MoveSpritePosition, ParticleOnSpriteAnimation, ParticleOnSpriteOffset, ParticleOnSpriteRandom, ParticleZoomAnimation, ParticleZoomXAnimation, ParticleZoomYAnimation, Player, RadiusMoveAnimation, RadiusMoveMarginAnimation, ResolverObjectCommand, ScalarAnimation, ScalarOffsetAnimation, ScalarXFromSprite, ScalarYFromSprite, SignalWaiter, SpriteCreationCommand, SpriteSheetAnimation, TimedAnimation, TimedCommands, TimedLoopAnimation, ToneAnimation, UserBankRelativeAnimation

Constant Summary collapse

DISTORTIONS =

Hash describing all the distortion proc

Returns:

  • (Hash{Symbol => Proc})
{SMOOTH_DISTORTION: proc { |x| 1 - Math.cos(pi_div2 * x ** 1.5) ** 5 }, UNICITY_DISTORTION: proc { |x| x }, SQUARE010_DISTORTION: proc { |x| 1 - (x * 2 - 1) ** 2 }, SIN: proc { |x| Math.sin(2 * Math::PI * x) }, BALL_FALL: proc { |x| (Math.cos(2.5 * Math::PI * x) * Math.exp(-2 * x)).abs }, FALLING_SMOOTH: proc { |x| 5 * r(x) - 6 * r(x - 0.2) + 1.25 * r(x - 0.4) - 0.25 * r(x - 0.6) }, POSITIVE_OSCILLATING_4: proc { |x| (Math.sin(8 * Math::PI * x) + 1) / 2 }, POSITIVE_OSCILLATING_16: proc { |x| (Math.sin(32 * Math::PI * x) + 1) / 2 }, POWDER_1: proc { |x| 1.5 + 5 * r(x) - 10 * r(x - 0.2) }, POWDER_2: proc { |x| 1.5 - 5 * r(x) + 10 * r(x - 0.8) }, POWDER_3: proc { |x| -0.5 + 5 * r(x) - 10 * r(x - 0.6) }, POWDER_4: proc { |x| -0.5 - 5 * r(x) + 10 * r(x - 0.4) }, POWDER_5: proc { |x| -2.5 + 5 * x }}
TIME_SOURCES =

Hash describing all the time sources

{GENERIC_TIME_SOURCE: Graphics.method(:current_time), SCENE_TIME_SOURCE: proc {$scene.respond_to?(:clock) ? $scene.clock.elapsed_time : Clock.main.elapsed_time }}
DEFAULT_RESOLVER =

Default object resolver (make the game crash)

Returns:

  • (Proc)
proc { |x| raise "Couldn't resolve object :#{x}" }

Class Method Summary collapse

Class Method Details

.anchor(on, to, z_offset = 0)

Parameters:

  • on (ShaderedSprite | Symbol) —

    object getting anchored

  • to (ShaderedSprite | Symbol) —

    object to anchor to

  • z_offset (Integer) (defaults to: 0) —

    offset z while anchoring to another object



1100
1101
# File 'docs/4_Systems_005_Animation.rb', line 1100

def anchor(on, to, z_offset = 0)
end

.bgm_play(filename, volume = 100, pitch = 100) ⇒ AudioCommand

Play a BGM

Parameters:

  • filename (String) —

    name of the file inside Audio/BGM

  • volume (Integer) (defaults to: 100) —

    volume to play the bgm

  • pitch (Integer) (defaults to: 100) —

    pitch used to play the bgm

Returns:



612
613
# File 'docs/4_Systems_005_Animation.rb', line 612

def bgm_play(filename, volume = 100, pitch = 100)
end

.bgm_stop ⇒ AudioCommand

Stop the bgm

Returns:



616
617
# File 'docs/4_Systems_005_Animation.rb', line 616

def bgm_stop
end

.bgs_play(filename, volume = 100, pitch = 100) ⇒ AudioCommand

Play a BGS

Parameters:

  • filename (String) —

    name of the file inside Audio/BGS

  • volume (Integer) (defaults to: 100) —

    volume to play the bgs

  • pitch (Integer) (defaults to: 100) —

    pitch used to play the bgs

Returns:



623
624
# File 'docs/4_Systems_005_Animation.rb', line 623

def bgs_play(filename, volume = 100, pitch = 100)
end

.bgs_stop ⇒ AudioCommand

Stop the bgs

Returns:



627
628
# File 'docs/4_Systems_005_Animation.rb', line 627

def bgs_stop
end

.camera_move_animation(target = :target, duration = 0.4) ⇒ Yuki::Animation::Player

Animation camera movement

Parameters:

  • target (Symbol) (defaults to: :target) —

    target of the camera movement

  • duration (Float) (defaults to: 0.4) —

    duration of the camera movement

Returns:



79
80
# File 'docs/5_Battle_20_MoveAnimation.rb', line 79

def camera_move_animation(target = :target, duration = 0.4)
end

.camera_reset_position ⇒ Yuki::Animation::Player

Animation Recenter movement

Returns:



83
84
# File 'docs/5_Battle_20_MoveAnimation.rb', line 83

def camera_reset_position
end

.cell_x_change(during, on, cell_start, cell_end, width, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE) ⇒ DiscreetAnimation

Create a src_rect.x animation convert it to another number (between 0 & 1) in order to distord time

Parameters:

  • during (Float) —

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

  • on (Object) —

    object that will receive the property (please give sprite.src_rect)

  • cell_start (Integer, Symbol) —

    start opacity

  • cell_end (Integer, Symbol) —

    end opacity

  • width (Integer, Symbol) —

    width of the cell

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

    callable taking one paramater (between 0 & 1) and

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

    callable taking no parameter and giving the current time

Returns:



462
463
# File 'docs/4_Systems_005_Animation.rb', line 462

def cell_x_change(during, on, cell_start, cell_end, width, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.cell_y_change(during, on, cell_start, cell_end, width, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)

Create a src_rect.y animation convert it to another number (between 0 & 1) in order to distord time

Parameters:

  • during (Float) —

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

  • on (Object) —

    object that will receive the property (please give sprite.src_rect)

  • cell_start (Integer, Symbol) —

    start opacity

  • cell_end (Integer, Symbol) —

    end opacity

  • width (Integer, Symbol) —

    width of the cell

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

    callable taking one paramater (between 0 & 1) and

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

    callable taking no parameter and giving the current time



473
474
# File 'docs/4_Systems_005_Animation.rb', line 473

def cell_y_change(during, on, cell_start, cell_end, width, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.combine_animation(animations, time_global)

Deprecated.

You can use parallel instead



88
89
# File 'docs/5_Battle_20_MoveAnimation.rb', line 88

def combine_animation(animations, time_global)
end

.combine_animation_with_sound(sound, animations, time_global)

Deprecated.

You can use player and parallel instead



91
92
# File 'docs/5_Battle_20_MoveAnimation.rb', line 91

def combine_animation_with_sound(sound, animations, time_global)
end

.combine_before_animation(animations)

Deprecated.

you can use player instead



94
95
# File 'docs/5_Battle_20_MoveAnimation.rb', line 94

def combine_before_animation(animations)
end

.combine_before_animation_with_sound(sound, animations)

Deprecated.

you can use player instead



97
98
# File 'docs/5_Battle_20_MoveAnimation.rb', line 97

def combine_before_animation_with_sound(sound, animations)
end

.compress(time_to_process, on, a, b, iteration: 1, distortion: :SQUARE010_DISTORTION, time_source: :SCENE_TIME_SOURCE) ⇒ CompressAnimation

Create a new CompressAnimation convert it to another number (between 0 & 1) in order to distort 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 (Integer) —

    value in x retrieved to the sprite_zoom

  • b (Integer) —

    value in y retrieved to the sprite_zoom

  • iteration (#call, Integer) (defaults to: 1) —

    number of iteration of the animation

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

    callable taking one parameter (between 0 & 1) and

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

    callable taking no parameter and giving the current time

Returns:



132
133
# File 'docs/5_Battle_20_MoveAnimation.rb', line 132

def compress(time_to_process, on, a, b, iteration: 1, distortion: :SQUARE010_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.create_sprite(viewport, name, type, args = nil, *properties) ⇒ SpriteCreationCommand

Create a new sprite

Parameters:

  • viewport (Symbol) —

    viewport to use inside the resolver

  • name (Symbol) —

    name of the sprite inside the resolver

  • type (Class) —

    class to use in order to create the sprite

  • args (Array) (defaults to: nil) —

    argument to send to the sprite in order to create it (sent after viewport)

  • properties (Array<Array>) —

    list of properties to call with their values

Returns:



666
667
# File 'docs/4_Systems_005_Animation.rb', line 666

def create_sprite(viewport, name, type, args = nil, *properties)
end

.discreet(time_to_process, on, property, a, b, factor = 1, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)

Create a new DiscreetAnimation 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

  • property (Symbol) —

    name of the property to affect (add the = sign in the symbol name)

  • a (Integer, Symbol) —

    origin position

  • b (Integer, Symbol) —

    destination position

  • factor (Integer, Symbol) (defaults to: 1) —

    factor applied to a & b to produce stuff like src_rect animation (sx * width)

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

    callable taking one paramater (between 0 & 1) and

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

    callable taking no parameter and giving the current time



485
486
# File 'docs/4_Systems_005_Animation.rb', line 485

def discreet(time_to_process, on, property, a, b, factor = 1, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.dispose_sprite(name) ⇒ ResolverObjectCommand

Dispose a sprite

Parameters:

  • name (Symbol) —

    name of the sprite in the resolver

Returns:



697
698
# File 'docs/4_Systems_005_Animation.rb', line 697

def dispose_sprite(name)
end

.ellipse(during, on, a, b, turn: 1, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE) ⇒ EllipseAnimation

Create an ellipse animation (follows an elliptical trajectory)

Parameters:

  • during (Float) —

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

  • on (Object) —

    object that will receive the property

  • a (Float, Symbol) —

    semi-major axis (horizontal radius)

  • b (Float, Symbol) —

    semi-minor axis (vertical radius)

  • turn (Integer) (defaults to: 1) —

    number of turns

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

    callable taking one parameter (between 0 & 1) and converting it to another number (between 0 & 1) to distort time

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

    callable taking no parameter and giving the current time

Returns:



923
924
# File 'docs/4_Systems_005_Animation.rb', line 923

def ellipse(during, on, a, b, turn: 1, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.eq(time_to_process, on, equations, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)

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

Examples:

ya.eq(ttp, sym, [[:angle, :cosine, { a: 360, f: 1 / 5.0, phi: pi2, b: 0 }]]))

Parameters:

  • time_to_process (Float) —

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

  • on (Object) —

    object that will receive the property

  • equations (Array<Array[property, eq, params]>) —

    list of equations to apply

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

    callable taking one paramater (between 0 & 1) and

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

    callable taking no parameter and giving the current time



1195
1196
# File 'docs/4_Systems_005_Animation.rb', line 1195

def eq(time_to_process, on, equations, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.eq_offset(time_to_process, on, equations, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)

Create a new EqOffsetAnimation 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

  • equations (Array<Array[property, eq, params]>) —

    list of equations to apply

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

    callable taking one paramater (between 0 & 1) and

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

    callable taking no parameter and giving the current time



1204
1205
# File 'docs/4_Systems_005_Animation.rb', line 1204

def eq_offset(time_to_process, on, equations, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.falling_animation(time_to_process, on, a, b, distortion: :FALLING_SMOOTH, time_source: :SCENE_TIME_SOURCE) ⇒ FallingAnimation

Create a new FallingAnimation

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) —

    Sprite that should hit

  • b (Float, Integer) —

    distance of the fall

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

    callable taking one parameter (between 0 & 1) and converting it to another number (between 0 & 1) to distort time

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

    callable taking no parameter and giving the current time

Returns:



959
960
# File 'docs/4_Systems_005_Animation.rb', line 959

def falling_animation(time_to_process, on, a, b, distortion: :FALLING_SMOOTH, time_source: :SCENE_TIME_SOURCE)
end

.healing_particle_animation(particle_id, properties) ⇒ HealingParticlePlayer

Create a healing particle animation.

Parameters:

  • particle_id (Symbol, String) —

    ID under which the sprite will be created

  • properties (Hash) —

    animation properties (see HealingParticlePlayer)

Returns:



165
166
# File 'docs/5_Battle_20_MoveAnimation.rb', line 165

def healing_particle_animation(particle_id, properties)
end

.me_play(filename, volume = 100, pitch = 100) ⇒ AudioCommand

Play a ME

Parameters:

  • filename (String) —

    name of the file inside Audio/ME

  • volume (Integer) (defaults to: 100) —

    volume to play the me

  • pitch (Integer) (defaults to: 100) —

    pitch used to play the me

Returns:



634
635
# File 'docs/4_Systems_005_Animation.rb', line 634

def me_play(filename, volume = 100, pitch = 100)
end

.message_locked_animation ⇒ MessageLocked

Function that creates a message locked animation

Returns:



759
760
# File 'docs/4_Systems_005_Animation.rb', line 759

def message_locked_animation
end

.move(during, on, start_x, start_y, end_x, end_y, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE) ⇒ Dim2Animation

Create a move animation (from a to b) convert it to another number (between 0 & 1) in order to distord time

Parameters:

  • during (Float) —

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

  • on (Object) —

    object that will receive the property

  • start_x (Float, Symbol) —

    start x

  • start_y (Float, Symbol) —

    start y

  • end_x (Float, Symbol) —

    end x

  • end_y (Float, Symbol) —

    end y

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

    callable taking one paramater (between 0 & 1) and

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

    callable taking no parameter and giving the current time

Returns:



398
399
# File 'docs/4_Systems_005_Animation.rb', line 398

def move(during, on, start_x, start_y, end_x, end_y, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.move_discreet(during, on, start_x, start_y, end_x, end_y, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE) ⇒ Dim2AnimationDiscreet

Create a move animation (from a to b) with discreet values (Integer) convert it to another number (between 0 & 1) in order to distord time

Parameters:

  • during (Float) —

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

  • on (Object) —

    object that will receive the property

  • start_x (Float, Symbol) —

    start x

  • start_y (Float, Symbol) —

    start y

  • end_x (Float, Symbol) —

    end x

  • end_y (Float, Symbol) —

    end y

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

    callable taking one paramater (between 0 & 1) and

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

    callable taking no parameter and giving the current time

Returns:



411
412
# File 'docs/4_Systems_005_Animation.rb', line 411

def move_discreet(during, on, start_x, start_y, end_x, end_y, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.move_particle_on_sprite(time_to_process, particle, on, start_x, start_y, final_x, final_y, use_zoom: true, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE) ⇒ MoveParticleOnSprite

Create a new MoveParticleOnSprite

Parameters:

  • time_to_process (Float) —

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

  • particle (Sprite, Sprite3D) —

    sprite that will moved

  • on (PokemonSprite, PokemonSprite3D) —

    based on which Sprite dimension it will navigate

  • start_x (Integer)
  • start_y (Integer)
  • final_x (Integer)
  • final_y (Integer)
  • use_zoom (Boolean) (defaults to: true) —

    use zoom of the sprite (by default true)

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

    callable taking one parameter (between 0 & 1) and converting it to another number (between 0 & 1) to distort time

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

    callable taking no parameter and giving the current time

Returns:



338
339
# File 'docs/5_Battle_20_MoveAnimation.rb', line 338

def move_particle_on_sprite(time_to_process, particle, on, start_x, start_y, final_x, final_y, use_zoom: true, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.move_sprite_position(time_to_process, on, a, b, distortion: :UNICITY_DISTORTION, time_source: :SCENE_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: :SCENE_TIME_SOURCE) —

    callable taking no parameter and giving the current time

Returns:



816
817
# File 'docs/4_Systems_005_Animation.rb', line 816

def move_sprite_position(time_to_process, on, a, b, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.opacity_change(during, on, opacity_start, opacity_end, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE) ⇒ ScalarAnimation

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

Parameters:

  • during (Float) —

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

  • on (Object) —

    object that will receive the property

  • opacity_start (Float, Symbol) —

    start opacity

  • opacity_end (Float, Symbol) —

    end opacity

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

    callable taking one paramater (between 0 & 1) and

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

    callable taking no parameter and giving the current time

Returns:



325
326
# File 'docs/4_Systems_005_Animation.rb', line 325

def opacity_change(during, on, opacity_start, opacity_end, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.parallel(animation, *parallel) ⇒ Player

Create an animation player with 1 animation and every other animation played in parallel

Parameters:

Returns:



183
184
# File 'docs/4_Systems_005_Animation.rb', line 183

def parallel(animation, *parallel)
end

.particle_move_to_sprite(time_to_process, particle, from, to, proportion_x = 1, proportion_y = 1, use_zoom: false, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE) ⇒ MoveParticleAnimation

Create a new MoveParticleAnimation

Parameters:

  • time_to_process (Float) —

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

  • particle (Sprite, Sprite3D) —

    sprite that will be moved

  • from (PokemonSprite, PokemonSprite3D) —

    based on which Sprite it will start

  • to (PokemonSprite, PokemonSprite3D) —

    on which Sprite it will go

  • proportion_x (Float) (defaults to: 1) —

    proportion of the sprite width that will cover (by default 1)

  • proportion_y (Float) (defaults to: 1) —

    proportion of the sprite height that will cover (by default 1)

  • use_zoom (Boolean) (defaults to: false) —

    is the zoom difference used (by default false)

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

    callable taking one parameter (between 0 & 1) and converting it to another number (between 0 & 1) to distort time

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

    callable taking no parameter and giving the current time

Returns:



232
233
# File 'docs/5_Battle_20_MoveAnimation.rb', line 232

def particle_move_to_sprite(time_to_process, particle, from, to, proportion_x = 1, proportion_y = 1, use_zoom: false, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.particle_move_to_sprite_offset(time_to_process, particle, from, to, offset_x = 0, offset_y = 0, from_center: false, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE) ⇒ MoveParticleOffsetAnimation

Create a new MoveParticleOffsetAnimation

Parameters:

  • time_to_process (Float) —

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

  • particle (Sprite, Sprite3D) —

    sprite that will be moved

  • from (PokemonSprite, PokemonSprite3D) —

    based on which Sprite it will start

  • to (PokemonSprite, PokemonSprite3D) —

    on which Sprite it will go

  • offset_x (Integer) (defaults to: 0) —

    offset on x

  • offset_y (Integer) (defaults to: 0) —

    offset on y

  • from_center (Boolean) (defaults to: false) —

    is the origin from the center of the sprite (by default false)

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

    callable taking one parameter (between 0 & 1) and converting it to another number (between 0 & 1) to distort time

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

    callable taking no parameter and giving the current time

Returns:



246
247
# File 'docs/5_Battle_20_MoveAnimation.rb', line 246

def particle_move_to_sprite_offset(time_to_process, particle, from, to, offset_x = 0, offset_y = 0, from_center: false, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.particle_on_sprite(time_to_process, particle, on, proportion_x = 1, proportion_y = 1, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE) ⇒ ParticleOnSpriteAnimation

Create a new ParticleOnSpriteAnimation

Parameters:

  • time_to_process (Float) —

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

  • particle (Sprite, Sprite3D) —

    sprite that will be placed

  • on (PokemonSprite, PokemonSprite3D) —

    based on which Sprite dimension it will be placed

  • proportion_x (Float) (defaults to: 1) —

    proportion of the sprite width that will cover (by default 1)

  • proportion_y (Float) (defaults to: 1) —

    proportion of the sprite height that will cover (by default 1)

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

    callable taking one parameter (between 0 & 1) and converting it to another number (between 0 & 1) to distort time

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

    callable taking no parameter and giving the current time

Returns:



366
367
# File 'docs/5_Battle_20_MoveAnimation.rb', line 366

def particle_on_sprite(time_to_process, particle, on, proportion_x = 1, proportion_y = 1, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.particle_on_sprite_command(particle, on, offset_x = 0, offset_y = 0) ⇒ ParticleOnSpriteOffset

Create a new ParticleOnSpriteOffset

Parameters:

  • particle (Sprite, Sprite3D) —

    sprite that will be placed

  • on (PokemonSprite, PokemonSprite3D) —

    based on which Sprite dimension it will be placed

  • offset_x (Integer) (defaults to: 0) —

    (by default 0)

  • offset_y (Integer) (defaults to: 0) —

    (by default 0)

Returns:



346
347
# File 'docs/5_Battle_20_MoveAnimation.rb', line 346

def particle_on_sprite_command(particle, on, offset_x = 0, offset_y = 0)
end

.particle_random_sprite_command(particle, on, proportion_x = 1, proportion_y = 1) ⇒ ParticleOnSpriteRandom

Create a new ParticleOnSpriteRandom

Parameters:

  • particle (Sprite, Sprite3D) —

    sprite that will be placed

  • on (PokemonSprite, PokemonSprite3D) —

    based on which Sprite dimension it will be placed

  • proportion_x (Integer) (defaults to: 1) —

    (by default 1)

  • proportion_y (Integer) (defaults to: 1) —

    (by default 1)

Returns:



354
355
# File 'docs/5_Battle_20_MoveAnimation.rb', line 354

def particle_random_sprite_command(particle, on, proportion_x = 1, proportion_y = 1)
end

.particle_zoom(time_to_process, particle, on, a, b, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE) ⇒ ParticleZoomAnimation

Create a new ParticleZoomAnimation

Parameters:

  • time_to_process (Float) —

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

  • particle (Sprite, Sprite3D) —

    sprite that will be placed

  • on (PokemonSprite, PokemonSprite3D) —

    Sprite from which the zoom will be based

  • a (Float) —

    zoom_start

  • b (Float) —

    zoom_final

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

    callable taking one parameter (between 0 & 1) and converting it to another number (between 0 & 1) to distort time

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

    callable taking no parameter and giving the current time

Returns:



416
417
# File 'docs/5_Battle_20_MoveAnimation.rb', line 416

def particle_zoom(time_to_process, particle, on, a, b, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.particle_zoom_x(time_to_process, particle, on, a, b, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE) ⇒ ParticleZoomXAnimation

Create a new ParticleZoomXAnimation

Parameters:

  • time_to_process (Float) —

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

  • particle (Sprite, Sprite3D) —

    sprite that will be placed

  • on (PokemonSprite, PokemonSprite3D) —

    Sprite from which the zoom will be based

  • a (Float) —

    zoom_start

  • b (Float) —

    zoom_final

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

    callable taking one parameter (between 0 & 1) and converting it to another number (between 0 & 1) to distort time

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

    callable taking no parameter and giving the current time

Returns:



428
429
# File 'docs/5_Battle_20_MoveAnimation.rb', line 428

def particle_zoom_x(time_to_process, particle, on, a, b, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.particle_zoom_y(time_to_process, particle, on, a, b, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE) ⇒ ParticleZoomYAnimation

Create a new ParticleZoomYAnimation

Parameters:

  • time_to_process (Float) —

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

  • particle (Sprite, Sprite3D) —

    sprite that will be placed

  • on (PokemonSprite, PokemonSprite3D) —

    Sprite from which the zoom will be based

  • a (Float) —

    zoom_start

  • b (Float) —

    zoom_final

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

    callable taking one parameter (between 0 & 1) and converting it to another number (between 0 & 1) to distort time

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

    callable taking no parameter and giving the current time

Returns:



440
441
# File 'docs/5_Battle_20_MoveAnimation.rb', line 440

def particle_zoom_y(time_to_process, particle, on, a, b, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.player(*animations, parallel: nil) ⇒ Player

Create an animation player

Parameters:

  • animations (Array<AnimationMixin>) —

    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

Returns:



177
178
# File 'docs/4_Systems_005_Animation.rb', line 177

def player(*animations, parallel: nil)
end

.r(x) ⇒ Float

Causal method

Parameters:

  • x (Float, Integer)

Returns:

  • (Float)


191
192
# File 'docs/4_Systems_005_Animation.rb', line 191

def r(x)
end

.radius_move(time_to_process, on, a, b, reversed: false, max_radius: 360, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE) ⇒ RadiusMoveAnimation

Create a new RadiusMoveAnimation convert it to another number (between 0 & 1) in order to distort 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 (Integer) —

    length of the movement

  • reversed (Boolean) (defaults to: false) —

    if the animation should be reversed

  • max_radius (Integer) (defaults to: 360) —

    max_radius for the angle direction

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

    callable taking one parameter (between 0 & 1) and

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

    callable taking no parameter and giving the current time

Returns:



1020
1021
# File 'docs/4_Systems_005_Animation.rb', line 1020

def radius_move(time_to_process, on, a, b, reversed: false, max_radius: 360, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.radius_move_margin(time_to_process, on, a, b, x_margin = 5, y_margin = 5, reversed: false, max_radius: 360, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE) ⇒ RadiusMoveMarginAnimation

Create a new RadiusMoveMarginAnimation convert it to another number (between 0 & 1) in order to distort 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 (Integer) —

    length of the movement

  • x_margin (Integer) (defaults to: 5) —

    x length of the margin origin

  • y_margin (Integer) (defaults to: 5) —

    y length of the margin origin

  • reversed (Boolean) (defaults to: false) —

    if the animation should be reversed

  • max_radius (Integer) (defaults to: 360) —

    max_radius for the angle direction

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

    callable taking one parameter (between 0 & 1) and

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

    callable taking no parameter and giving the current time

Returns:



1035
1036
# File 'docs/4_Systems_005_Animation.rb', line 1035

def radius_move_margin(time_to_process, on, a, b, x_margin = 5, y_margin = 5, reversed: false, max_radius: 360, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.resolved(*animations) ⇒ FullyResolvedAnimation

Create a fully resolved animation

Parameters:

Returns:



858
859
# File 'docs/4_Systems_005_Animation.rb', line 858

def resolved(*animations)
end

.rotation(during, on, angle_start, angle_end, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE) ⇒ ScalarAnimation

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

Parameters:

  • during (Float) —

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

  • on (Object) —

    object that will receive the property

  • angle_start (Float, Symbol) —

    start angle

  • angle_end (Float, Symbol) —

    end angle

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

    callable taking one paramater (between 0 & 1) and

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

    callable taking no parameter and giving the current time

Returns:



314
315
# File 'docs/4_Systems_005_Animation.rb', line 314

def rotation(during, on, angle_start, angle_end, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.run_commands_during(duration, *animation_commands) ⇒ TimedCommands

Note:

Never put dispose command inside this command, there's risk that it does not execute

Try to run commands during a specific duration and giving a fair repartition of the duraction for each commands

Parameters:

  • duration (Float) —

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

  • animation_commands (Array<Command>)

Returns:



721
722
# File 'docs/4_Systems_005_Animation.rb', line 721

def run_commands_during(duration, *animation_commands)
end

.scalar(time_to_process, on, property, a, b, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE) ⇒ ScalarAnimation

Create a scalar animation 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

  • property (Symbol) —

    name of the property to affect (add the = sign in the symbol name)

  • a (Float, Symbol) —

    origin position

  • b (Float, Symbol) —

    destination position

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

    callable taking one paramater (between 0 & 1) and

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

    callable taking no parameter and giving the current time

Returns:



337
338
# File 'docs/4_Systems_005_Animation.rb', line 337

def scalar(time_to_process, on, property, a, b, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.scalar_offset(time_to_process, on, property_get, property_set, a, b, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE) ⇒ ScalarOffsetAnimation

Create a new ScalarOffsetAnimation



385
386
# File 'docs/4_Systems_005_Animation.rb', line 385

def scalar_offset(time_to_process, on, property_get, property_set, a, b, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.scalar_x_from_sprite(time_to_process, on, sprite, start_x, offset_x, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE) ⇒ ScalarXFromSprite

Create a scalar animation on the x property of an element, linked to a sprite for the original position convert it to another number (between 0 & 1) in order to distort time

Parameters:

  • time_to_process (Float) —

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

  • on (Object) —

    object that will receive the property

  • sprite (Object) —

    on which the origin will be based on

  • start_x (Integer) —

    start_x

  • offset_x (Integer) —

    offset_x

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

    callable taking one parameter (between 0 & 1) and

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

    callable taking no parameter and giving the current time

Returns:



498
499
# File 'docs/5_Battle_20_MoveAnimation.rb', line 498

def scalar_x_from_sprite(time_to_process, on, sprite, start_x, offset_x, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.scalar_y_from_sprite(time_to_process, on, sprite, start_y, offset_y, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE) ⇒ ScalarYFromSprite

Create a scalar animation on the y property of an element, linked to a sprite for the original position convert it to another number (between 0 & 1) in order to distort time

Parameters:

  • time_to_process (Float) —

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

  • on (Object) —

    object that will receive the property

  • sprite (Object) —

    on which the origin will be based on

  • start_y (Integer) —

    start_y

  • offset_y (Integer) —

    offset_y

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

    callable taking one parameter (between 0 & 1) and

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

    callable taking no parameter and giving the current time

Returns:



510
511
# File 'docs/5_Battle_20_MoveAnimation.rb', line 510

def scalar_y_from_sprite(time_to_process, on, sprite, start_y, offset_y, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.se_play(filename, volume = 100, pitch = 100) ⇒ AudioCommand

Play a SE

Parameters:

  • filename (String) —

    name of the file inside Audio/SE

  • volume (Integer) (defaults to: 100) —

    volume to play the se

  • pitch (Integer) (defaults to: 100) —

    pitch used to play the se

Returns:



641
642
# File 'docs/4_Systems_005_Animation.rb', line 641

def se_play(filename, volume = 100, pitch = 100)
end

.send_command_to(name, command, *args) ⇒ ResolverObjectCommand

Send a command to an object in the resolver

Parameters:

  • name (Symbol) —

    name of the object in the resolver

  • command (Symbol) —

    name of the method to call

  • args (Array) —

    arguments to send to the method

Returns:



692
693
# File 'docs/4_Systems_005_Animation.rb', line 692

def send_command_to(name, command, *args)
end

.shift(during, on, start_x, start_y, end_x, end_y, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE) ⇒ Dim2Animation

Create a origin pixel shift animation (from a to b inside the bitmap) convert it to another number (between 0 & 1) in order to distord time

Parameters:

  • during (Float) —

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

  • on (Object) —

    object that will receive the property

  • start_x (Float, Symbol) —

    start ox

  • start_y (Float, Symbol) —

    start oy

  • end_x (Float, Symbol) —

    end ox

  • end_y (Float, Symbol) —

    end oy

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

    callable taking one paramater (between 0 & 1) and

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

    callable taking no parameter and giving the current time

Returns:



424
425
# File 'docs/4_Systems_005_Animation.rb', line 424

def shift(during, on, start_x, start_y, end_x, end_y, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.sprite_sheet_animation(time_to_process, on, cells, rounding = :round, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE) ⇒ SpriteSheetAnimation

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 (SpriteSheet, Symbol) —

    object that will receive the property

  • cells (Array<Array<Integer>>, Symbol) —

    all the select arguments that should be sent during the animation

  • rounding (Symbol) (defaults to: :round) —

    kind of rounding, can be: :ceil, :round, :floor

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

    callable taking one paramater (between 0 & 1) and

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

    callable taking no parameter and giving the current time

Returns:



570
571
# File 'docs/4_Systems_005_Animation.rb', line 570

def sprite_sheet_animation(time_to_process, on, cells, rounding = :round, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.timed_loop_animation(time_to_process, animations = nil, parallel = nil, distortion = :UNICITY_DISTORTION, time_source = :SCENE_TIME_SOURCE) ⇒ TimedLoopAnimation

Create a new TimedLoopAnimation 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

  • 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

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

    callable taking no parameter and giving the current time

Returns:



826
827
# File 'docs/4_Systems_005_Animation.rb', line 826

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

.tone_animation(time_to_process, on, a, b = a, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE) ⇒ ToneAnimation

Create a new ToneAnimation convert it to another number (between 0 & 1) in order to distort 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 (Array(Integer, Integer, Integer, Integer)) —

    Initial tone values for the animation.

  • b (Array(Integer, Integer, Integer, Integer)) (defaults to: a) —

    Target tone values for the animation.

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

    callable taking one parameter (between 0 & 1) and

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

    callable taking no parameter and giving the current time

Returns:



1070
1071
# File 'docs/4_Systems_005_Animation.rb', line 1070

def tone_animation(time_to_process, on, a, b = a, distortion: :UNICITY_DISTORTION, time_source: :SCENE_TIME_SOURCE)
end

.user_bank_relative_animation(banks = nil) ⇒ UserBankRelativeAnimation

Create a new UserBankRelativeAnimation

Parameters:

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

    animations that plays on each banks

Returns:



71
72
# File 'docs/5_Battle_20_MoveAnimation.rb', line 71

def user_bank_relative_animation(banks = nil)
end

.wait(during, time_source: :SCENE_TIME_SOURCE) ⇒ TimedAnimation

Create a "wait" animation

Parameters:

  • during (Float) —

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

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

    callable taking no parameter and giving the current time

Returns:



207
208
# File 'docs/4_Systems_005_Animation.rb', line 207

def wait(during, time_source: :SCENE_TIME_SOURCE)
end

.wait_signal(name = nil, *args, &block) ⇒ SignalWaiter

Create a new SignalWaiter animation

Parameters:

  • name (Symbol) (defaults to: nil) —

    name of the block in resolver to call to know if the signal is there

  • args (Array) —

    optional arguments to the block

  • block (Proc) —

    if provided, name will be ignored and this block will be used (it prevents this animation from being savable!)

Returns:



884
885
# File 'docs/4_Systems_005_Animation.rb', line 884

def wait_signal(name = nil, *args, &block)
end