I think there is a mistake in the version at the processing wiki (which I have flagged) because the 2D lines mentioned in the comments have six parameters (in my book that is 3D line even if Z is zero). You still get to see the parallax in my amended version, try it.
###################
# processing screenX example
# in ruby processing
###################
def setup
size 100, 100, P3D
end
def draw
background 204
x = mouse_x
y = mouse_y
z = -100
# Draw "X" at z = -100
stroke 255
line(x - 10, y - 10, z, x + 10, y + 10, z)
line(x + 10, y - 10, z, x - 10, y + 10, z)
# Draw line in 2D at same x value
# Notice the parallax
stroke 102
line(x, 0, x, height)
# Draw 2D line to match the x value
# element drawn at z = -100
stroke(0)
the_x = screen_x(x, y, z)
line(the_x, 0, the_x, height)
end
Experiments with ruby-processing (processing-2.2.1) and JRubyArt for processing-3.0
Thursday, 5 May 2011
Subscribe to:
Post Comments (Atom)
Followers
About Me
- monkstone
- I have developed JRubyArt and propane new versions of ruby-processing for JRuby-9.1.5.0 and processing-3.2.2
No comments:
Post a Comment