Method: Ray::Animation::BlockAnimation#setup

Defined in:
lib/ray/animation/block_animation.rb

#setup(opts) ⇒ Object

Parameters:

  • opts (Hash)

    a customizable set of options

Options Hash (opts):

  • :block (#call)

    Object which will be called with the target and a progression between 0 and 1.

  • :proc (#call)

    Same as :block.

  • :reversed (true, false) — default: false

    True to make the progression decrease from 1 to 0.

  • :duration (Float)

    Duration in seconds.



18
19
20
21
22
23
# File 'lib/ray/animation/block_animation.rb', line 18

def setup(opts)
  @block    = opts[:block] || opts[:proc]
  @reversed = opts.key?(:reversed) ? opts[:reversed] : false

  self.duration = opts[:duration]
end