Class: Plushie::Animation::Sequence
- Inherits:
-
Data
- Object
- Data
- Plushie::Animation::Sequence
- Defined in:
- lib/plushie/animation/sequence.rb
Overview
Renderer-side sequential animation chain.
Chains multiple transitions and springs that execute one after another on the same prop. Each step's +from:+ defaults to the previous step's final value if not specified.
Instance Attribute Summary collapse
-
#on_complete ⇒ Object
readonly
Returns the value of attribute on_complete.
-
#steps ⇒ Object
readonly
Returns the value of attribute steps.
Class Method Summary collapse
-
.build(steps, **opts) ⇒ Sequence
Create a sequence from a list of transition/spring steps.
Instance Method Summary collapse
-
#initialize(steps:, on_complete: nil) ⇒ Sequence
constructor
A new instance of Sequence.
-
#to_wire ⇒ Hash
Wire-ready descriptor map.
Constructor Details
#initialize(steps:, on_complete: nil) ⇒ Sequence
Returns a new instance of Sequence.
29 30 31 |
# File 'lib/plushie/animation/sequence.rb', line 29 def initialize(steps:, on_complete: nil) super end |
Instance Attribute Details
#on_complete ⇒ Object (readonly)
Returns the value of attribute on_complete
26 27 28 |
# File 'lib/plushie/animation/sequence.rb', line 26 def on_complete @on_complete end |
#steps ⇒ Object (readonly)
Returns the value of attribute steps
26 27 28 |
# File 'lib/plushie/animation/sequence.rb', line 26 def steps @steps end |
Class Method Details
.build(steps, **opts) ⇒ Sequence
Create a sequence from a list of transition/spring steps.
49 50 51 52 53 54 55 |
# File 'lib/plushie/animation/sequence.rb', line 49 def self.build(steps, **opts) unless steps.is_a?(Array) && steps.all? { |s| s.respond_to?(:to_wire) } raise ArgumentError, "sequence steps must be an Array of Transition/Spring descriptors" end new(steps: steps, **opts) end |
Instance Method Details
#to_wire ⇒ Hash
Returns wire-ready descriptor map.
34 35 36 37 38 39 40 41 |
# File 'lib/plushie/animation/sequence.rb', line 34 def to_wire h = { type: "sequence", steps: steps.map(&:to_wire) } h[:on_complete] = on_complete.to_s if on_complete h end |