Class: SparkleMotion::Nodes::Transforms::Contrast
- Inherits:
-
SparkleMotion::Nodes::Transform
- Object
- SparkleMotion::Node
- SparkleMotion::Nodes::Transform
- SparkleMotion::Nodes::Transforms::Contrast
- Defined in:
- lib/sparkle_motion/nodes/transforms/contrast.rb
Overview
Transform values from 0..1 into a new range.
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
-
#initialize(function:, iterations:, source:, mask: nil) ⇒ Contrast
constructor
A new instance of Contrast.
- #update(t) ⇒ Object
Methods inherited from SparkleMotion::Node
Constructor Details
#initialize(function:, iterations:, source:, mask: nil) ⇒ Contrast
Returns a new instance of Contrast.
6 7 8 9 10 |
# File 'lib/sparkle_motion/nodes/transforms/contrast.rb', line 6 def initialize(function:, iterations:, source:, mask: nil) super(source: source, mask: mask) function = Perlin::Curve.const_get(function.to_s.upcase) @contrast = Perlin::Curve.contrast(function, iterations.to_i) end |
Instance Method Details
#update(t) ⇒ Object
12 13 14 15 16 |
# File 'lib/sparkle_motion/nodes/transforms/contrast.rb', line 12 def update(t) super(t) do |x| @contrast.call(@source[x]) end end |