Class: Vizcore::DSL::Engine::TransitionBuilder Private
- Inherits:
-
Object
- Object
- Vizcore::DSL::Engine::TransitionBuilder
- Defined in:
- lib/vizcore/dsl/engine.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Builder object for ‘transition` block internals.
Instance Method Summary collapse
- #effect(name, **options) ⇒ void private
-
#initialize ⇒ TransitionBuilder
constructor
private
A new instance of TransitionBuilder.
-
#on_bar(count, beats_per_bar: 4) ⇒ void
private
Trigger after a scene-local bar count reaches the given value.
-
#on_beat(count) ⇒ void
private
Trigger after a scene-local beat count reaches the given value.
-
#to_h ⇒ Hash
private
Serialized transition extras.
- #trigger { ... } ⇒ void private
Constructor Details
#initialize ⇒ TransitionBuilder
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of TransitionBuilder.
512 513 514 515 |
# File 'lib/vizcore/dsl/engine.rb', line 512 def initialize @effect = nil @trigger = nil end |
Instance Method Details
#effect(name, **options) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
520 521 522 523 524 525 |
# File 'lib/vizcore/dsl/engine.rb', line 520 def effect(name, **) @effect = { name: name.to_sym, options: .each_with_object({}) { |(key, value), output| output[key.to_sym] = value } } end |
#on_bar(count, beats_per_bar: 4) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Trigger after a scene-local bar count reaches the given value.
549 550 551 552 553 554 555 556 |
# File 'lib/vizcore/dsl/engine.rb', line 549 def (count, beats_per_bar: 4) = Integer(count) beats = Integer() raise ArgumentError, "on_bar count must be positive" unless .positive? raise ArgumentError, "beats_per_bar must be positive" unless beats.positive? on_beat( * beats) end |
#on_beat(count) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Trigger after a scene-local beat count reaches the given value.
537 538 539 540 541 542 |
# File 'lib/vizcore/dsl/engine.rb', line 537 def on_beat(count) beat_target = Integer(count) raise ArgumentError, "on_beat count must be positive" unless beat_target.positive? @trigger = proc { beat_count >= beat_target } end |
#to_h ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns serialized transition extras.
559 560 561 562 563 564 |
# File 'lib/vizcore/dsl/engine.rb', line 559 def to_h output = {} output[:effect] = @effect if @effect output[:trigger] = @trigger if @trigger output end |
#trigger { ... } ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
529 530 531 |
# File 'lib/vizcore/dsl/engine.rb', line 529 def trigger(&block) @trigger = block end |