https://github.com/ruby-processing/arcball
ArcBall functionality for processing (ruby versions) as gem
https://github.com/ruby-processing/arcball
arcball arcball-functionality picrate propane rotation
Last synced: 10 months ago
JSON representation
ArcBall functionality for processing (ruby versions) as gem
- Host: GitHub
- URL: https://github.com/ruby-processing/arcball
- Owner: ruby-processing
- License: gpl-3.0
- Created: 2016-03-13T07:08:02.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2021-10-10T15:38:56.000Z (over 4 years ago)
- Last Synced: 2025-02-17T12:45:42.418Z (about 1 year ago)
- Topics: arcball, arcball-functionality, picrate, propane, rotation
- Language: Java
- Size: 81.1 KB
- Stars: 0
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# ArcBall
ArcBall functionality for processing (ruby versions) as gem
### Example Usage
The sketch class need to to inherit from PApplet to work and self should return such an instance. The following is a propane example. Drag mouse to rotate. Hold down 'x', 'y' or 'z' keys to constrain axis of rotation, mouse-wheel to zoom.
```ruby
class ArcBallBox < Propane::App
############################
# Use mouse drag to rotate
# the arcball. Use mousewheel
# to zoom. Hold down x, y, z
# to constrain rotation axis.
############################
def setup
sketch_title 'Arcball Box'
Processing::ArcBall.init self, 300, 300
fill 180
end
def draw
background 50
box 300, 300, 300
end
def settings
size 600, 600, P3D
smooth 8
end
end
ArcBallBox.new
```
Since version 0.0.2, you can also fix rotation to one axis at initialization
```ruby
require 'arcball'
def setup
size(600, 600, P3D)
smooth(8)
Processing::ArcBall.constrain self #, :zaxis # default constrains to y-axis
fill 180
end
def draw
background(50)
box(300, 300, 300)
end
```