Class: Plushie::Canvas::Shape::Scale
- Inherits:
-
Data
- Object
- Data
- Plushie::Canvas::Shape::Scale
- Defined in:
- lib/plushie/canvas/shape/transform.rb
Overview
Scales the canvas coordinate system.
Use x/y for independent axis scaling, or factor for uniform scaling.
Instance Attribute Summary collapse
-
#factor ⇒ Object
readonly
Returns the value of attribute factor.
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Instance Method Summary collapse
-
#initialize(x: nil, y: nil, factor: nil) ⇒ Scale
constructor
A new instance of Scale.
-
#to_wire ⇒ Hash
Wire-ready transform map.
Constructor Details
#initialize(x: nil, y: nil, factor: nil) ⇒ Scale
Returns a new instance of Scale.
47 48 49 |
# File 'lib/plushie/canvas/shape/transform.rb', line 47 def initialize(x: nil, y: nil, factor: nil) super end |
Instance Attribute Details
#factor ⇒ Object (readonly)
Returns the value of attribute factor
46 47 48 |
# File 'lib/plushie/canvas/shape/transform.rb', line 46 def factor @factor end |
#x ⇒ Object (readonly)
Returns the value of attribute x
46 47 48 |
# File 'lib/plushie/canvas/shape/transform.rb', line 46 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y
46 47 48 |
# File 'lib/plushie/canvas/shape/transform.rb', line 46 def y @y end |
Instance Method Details
#to_wire ⇒ Hash
Returns wire-ready transform map.
52 53 54 55 56 57 58 |
# File 'lib/plushie/canvas/shape/transform.rb', line 52 def to_wire h = {type: "scale"} h[:x] = x if x h[:y] = y if y h[:factor] = factor if factor h end |