Class: SparkleMotion::Nodes::Transforms::Spotlight
- Inherits:
-
SparkleMotion::Nodes::Transform
- Object
- SparkleMotion::Node
- SparkleMotion::Nodes::Transform
- SparkleMotion::Nodes::Transforms::Spotlight
- Defined in:
- lib/sparkle_motion/nodes/transforms/spotlight.rb
Overview
Spotlight a particular point on the line.
TODO: Integrate the underlying light value but ensure we contrast-stretch TODO: to ensure a bright-enough spotlight over the destination. Maybe a LERP?
TODO: Allow effect to come in / go out over time.
Constant Summary
Constants inherited from SparkleMotion::Node
SparkleMotion::Node::DEBUG_SCALE, SparkleMotion::Node::FRAME_PERIOD
Instance Attribute Summary
Attributes inherited from SparkleMotion::Node
Instance Method Summary collapse
- #clear! ⇒ Object
-
#initialize(source:, mask: nil) ⇒ Spotlight
constructor
A new instance of Spotlight.
- #spotlight!(x) ⇒ Object
- #update(t) ⇒ Object
Methods inherited from SparkleMotion::Node
Constructor Details
#initialize(source:, mask: nil) ⇒ Spotlight
Returns a new instance of Spotlight.
11 12 13 14 |
# File 'lib/sparkle_motion/nodes/transforms/spotlight.rb', line 11 def initialize(source:, mask: nil) super(source: source, mask: mask) @spotlight = nil end |
Instance Method Details
#clear! ⇒ Object
20 |
# File 'lib/sparkle_motion/nodes/transforms/spotlight.rb', line 20 def clear!; @spotlight = nil; end |
#spotlight!(x) ⇒ Object
16 17 18 |
# File 'lib/sparkle_motion/nodes/transforms/spotlight.rb', line 16 def spotlight!(x) @spotlight = x end |
#update(t) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/sparkle_motion/nodes/transforms/spotlight.rb', line 22 def update(t) super(t) do |x| val = @source[x] if @spotlight falloff = 0.9**((@spotlight - x).abs**3) val = falloff end val end end |