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.
388 389 390 391 |
# File 'lib/vizcore/dsl/engine.rb', line 388 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.
396 397 398 399 400 401 |
# File 'lib/vizcore/dsl/engine.rb', line 396 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.
425 426 427 428 429 430 431 432 |
# File 'lib/vizcore/dsl/engine.rb', line 425 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.
413 414 415 416 417 418 |
# File 'lib/vizcore/dsl/engine.rb', line 413 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.
435 436 437 438 439 440 |
# File 'lib/vizcore/dsl/engine.rb', line 435 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.
405 406 407 |
# File 'lib/vizcore/dsl/engine.rb', line 405 def trigger(&block) @trigger = block end |