module Sandoz
Constants
- VERSION
Public Instance Methods
background(r, g=nil, b=nil)
click to toggle source
# File lib/sandoz/sandoz.rb, line 24 def background(r, g=nil, b=nil) if g == nil && b == nil `#{@@p}.background(#{r})` else `#{@@p}.background(#{r}, #{g}, #{b})` end end
color(r, g=nil, b=nil, a=nil)
click to toggle source
# File lib/sandoz/sandoz.rb, line 104 def color(r, g=nil, b=nil, a=nil) if g==nil && b ==nil `return #{@@p}.color(#{r})` elsif a == nil `return #{@@p}.color(#{r}, #{g}, #{b})` else `return #{@@p}.color(#{r}, #{g}, #{b}, #{a})` end end
defsketch(id, &block)
click to toggle source
github.com/processing/p5.js/wiki/p5.js-overview#instantiation–namespace TODO Add html element argument
# File lib/sandoz/sandoz.rb, line 4 def defsketch(id, &block) sketch = Proc.new do |p| init(p) block.call end @p5 = `new p5(#{sketch}, #{id})` end
dist(x1, y1, x2, y2)
click to toggle source
# File lib/sandoz/sandoz.rb, line 92 def dist(x1, y1, x2, y2) `return #{@@p}.dist(x1, y1, x2, y2)` end
draw(&block)
click to toggle source
# File lib/sandoz/sandoz.rb, line 88 def draw(&block) `#{@@p}.draw = #{block}` end
ellipse(x, y, w, h)
click to toggle source
# File lib/sandoz/sandoz.rb, line 46 def ellipse(x, y, w, h) `#{@@p}.ellipse(#{x}, #{y}, #{w}, #{h})` end
fill(r, g=nil, b=nil, a=nil)
click to toggle source
# File lib/sandoz/sandoz.rb, line 32 def fill(r, g=nil, b=nil, a=nil) if g==nil && b ==nil `#{@@p}.fill(#{r})` elsif a == nil `#{@@p}.fill(#{r}, #{g}, #{b})` else `#{@@p}.fill(#{r}, #{g}, #{b}, #{a})` end end
height()
click to toggle source
# File lib/sandoz/sandoz.rb, line 54 def height `#{@@p}.height` end
init(p)
click to toggle source
# File lib/sandoz/sandoz.rb, line 16 def init(p) @@p = p end
line(x1, y1, x2, y2)
click to toggle source
# File lib/sandoz/sandoz.rb, line 58 def line(x1, y1, x2, y2) `#{@@p}.line(#{x1}, #{y1}, #{x2}, #{y2})` end
map(value, start1, stop1, start2, stop2)
click to toggle source
# File lib/sandoz/sandoz.rb, line 114 def map(value, start1, stop1, start2, stop2) `return #{@@p}.map(#{value}, #{start1}, #{stop1}, #{start2}, #{stop2})` end
millis()
click to toggle source
# File lib/sandoz/sandoz.rb, line 118 def millis `return #{@@p}.millis();` end
no_fill()
click to toggle source
# File lib/sandoz/sandoz.rb, line 122 def no_fill `#{@@p}.noFill()` end
no_stroke()
click to toggle source
# File lib/sandoz/sandoz.rb, line 76 def no_stroke `#{@@p}.noStroke()` end
noise(x, y=nil, z=nil)
click to toggle source
# File lib/sandoz/sandoz.rb, line 126 def noise(x, y=nil, z=nil) if y == nil && z == nil `return #{@@p}.noise(#{x})` elsif z == nil `return #{@@p}.noise(#{x}, #{y})` else `return #{@@p}.noise(#{x}, #{y}, #{z})` end end
point(x, y)
click to toggle source
# File lib/sandoz/sandoz.rb, line 62 def point(x, y) `#{@@p}.point(#{x}, #{y})` end
random(min, max=nil)
click to toggle source
# File lib/sandoz/sandoz.rb, line 96 def random(min, max=nil) if max `return #{@@p}.random(#{min}, #{max})` else `return #{@@p}.random(#{min})` end end
rect(x, y, w, h)
click to toggle source
# File lib/sandoz/sandoz.rb, line 42 def rect(x, y, w, h) `#{@@p}.rect(#{x}, #{y}, #{w}, #{h})` end
setup(&block)
click to toggle source
# File lib/sandoz/sandoz.rb, line 84 def setup(&block) `#{@@p}.setup = #{block}` end
size(w, h)
click to toggle source
# File lib/sandoz/sandoz.rb, line 20 def size(w, h) `#{@@p}.createCanvas(#{w}, #{h})` end
stroke(r, g=nil, b=nil, a=nil)
click to toggle source
# File lib/sandoz/sandoz.rb, line 66 def stroke(r, g=nil, b=nil, a=nil) if g==nil && b ==nil `#{@@p}.stroke(#{r})` elsif a == nil `#{@@p}.stroke(#{r}, #{g}, #{b})` else `#{@@p}.stroke(#{r}, #{g}, #{b}, #{a})` end end
stroke_weight(weight)
click to toggle source
# File lib/sandoz/sandoz.rb, line 80 def stroke_weight(weight) `#{@@p}.strokeWeight(#{weight})` end
text(text, x, y)
click to toggle source
# File lib/sandoz/sandoz.rb, line 136 def text(text, x, y) `#{@@p}.text(#{text}, #{x}, #{y})` end
view_p()
click to toggle source
# File lib/sandoz/sandoz.rb, line 12 def view_p `return #{@p5}` end
width()
click to toggle source
# File lib/sandoz/sandoz.rb, line 50 def width `#{@@p}.width` end