Class: RubySketch::Pin
- Inherits:
-
Object
- Object
- RubySketch::Pin
- Defined in:
- lib/rubysketch/pin.rb
Overview
A pin fastened at a point on a sprite. Creating a constraint between sprites starts from a pin.
Instance Method Summary collapse
-
#chase(*args, **options, &block) ⇒ ChaseConstraint
Creates a constraint that moves the pin toward the target every frame.
-
#link(*args, **options, &block) ⇒ LinkConstraint
Creates a constraint that keeps the distance to the target point.
-
#position ⇒ Vector?
(also: #pos)
Returns the position of the pin.
-
#snap(*args, **options, &block) ⇒ SnapConstraint
Creates a constraint that makes the pin and the target point coincide.
-
#sprite ⇒ Sprite?
Returns the sprite the pin is fastened to.
-
#wheel(*args, **options, &block) ⇒ WheelConstraint
Creates a constraint that makes the pin ride on the target like a wheel: it slides along an axis for the suspension and spins freely.
Instance Method Details
#chase(*args, **options, &block) ⇒ ChaseConstraint
Creates a constraint that moves the pin toward the target every frame.
65 66 67 |
# File 'lib/rubysketch/pin.rb', line 65 def chase(*args, **, &block) create__ ChaseConstraint, @pin__.chase(*unwrap__(args)), , block end |
#link(*args, **options, &block) ⇒ LinkConstraint
Creates a constraint that keeps the distance to the target point.
40 41 42 |
# File 'lib/rubysketch/pin.rb', line 40 def link(*args, **, &block) create__ LinkConstraint, @pin__.link(*unwrap__(args)), , block end |
#position ⇒ Vector? Also known as: pos
Returns the position of the pin.
81 82 83 |
# File 'lib/rubysketch/pin.rb', line 81 def position() @pin__.position&.toVector end |
#snap(*args, **options, &block) ⇒ SnapConstraint
Creates a constraint that makes the pin and the target point coincide.
28 29 30 |
# File 'lib/rubysketch/pin.rb', line 28 def snap(*args, **, &block) create__ SnapConstraint, @pin__.snap(*unwrap__(args)), , block end |
#sprite ⇒ Sprite?
Returns the sprite the pin is fastened to.
73 74 75 |
# File 'lib/rubysketch/pin.rb', line 73 def sprite() @sprite__ end |
#wheel(*args, **options, &block) ⇒ WheelConstraint
Creates a constraint that makes the pin ride on the target like a wheel: it slides along an axis for the suspension and spins freely.
53 54 55 |
# File 'lib/rubysketch/pin.rb', line 53 def wheel(*args, **, &block) create__ WheelConstraint, @pin__.wheel(*unwrap__(args)), , block end |