class DYI::Animation::Base
Base
class for animation classes. @abstract
Constants
- IMPLEMENT_ATTRIBUTES
- VALID_VALUES
Public Class Methods
new(shape, options)
click to toggle source
@param [Shape::Base] shape a target element for an animation @param [Hash] options an option for an animation
# File lib/dyi/animation.rb, line 193 def initialize(shape, options) raise ArgumentError, "`:to' option is required" unless options.key?(:to) @shape = shape options.each do |attr, value| if IMPLEMENT_ATTRIBUTES.include?(attr.to_sym) __send__("#{attr}=", value) end end @relays ||= [] @relay_times ||= [] end
Public Instance Methods
accumulate=(value)
click to toggle source
@param [Boolean] value @since 1.3.0
# File lib/dyi/animation.rb, line 187 def accumulate=(value) @accumulate = value end
accumulate?()
click to toggle source
Returns whether the animation is cumulative. @return [Boolean] true if the animation is cumulative, false otherwise @since 1.3.0
# File lib/dyi/animation.rb, line 115 def accumulate? @accumulate ? true : false end
begin_event=(event)
click to toggle source
# File lib/dyi/animation.rb, line 159 def begin_event=(event) @begin_event = event end
begin_offset=(offset)
click to toggle source
# File lib/dyi/animation.rb, line 155 def begin_offset=(offset) @begin_offset = offset.to_f end
duration=(duration)
click to toggle source
# File lib/dyi/animation.rb, line 144 def duration=(duration) @duration = duration.to_f end
end_event=(event)
click to toggle source
# File lib/dyi/animation.rb, line 167 def end_event=(event) @end_event = event end
end_offset=(offset)
click to toggle source
# File lib/dyi/animation.rb, line 163 def end_offset=(offset) @end_offset = offset.to_f end
key_splines=(keys)
click to toggle source
@attribute [w] key_splines @param [Array<#to_f>] keys @since 1.3.0
# File lib/dyi/animation.rb, line 181 def key_splines=(keys) @key_splines = keys.map{|time| time.to_f} end
relay_times=(times)
click to toggle source
@attribute [w] relays @param [Array<#to_f>] times @since 1.3.0
# File lib/dyi/animation.rb, line 174 def relay_times=(times) @relay_times = times.map{|time| time.to_f} end
repeat_count=(count)
click to toggle source
@attribute [w] repeat_count @param [#to_f] count @since 1.3.0
# File lib/dyi/animation.rb, line 151 def repeat_count=(count) @repeat_count = count.to_f end