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
Here is my blog in which I will describe my experiments with ruby-processing, find out more about ruby-processing at:- http://wiki.github.com/jashkenas/ruby-processing and http://github.com/jashkenas/context_free for the cfdg DSL (context-free-art)
Thursday, 5 May 2011
Subscribe to:
Post Comments (Atom)
Blog Archive
-
►
2010
(73)
-
►
September
(15)
- Basic Hair Example SunflowAPIAPI just using jruby
- Basic Hair Example SunflowAPIAPI in ruby processin...
- SunflowAPIAPI in ruby processing
- A Staffordshire Knot Using Ruby Processing and A C...
- An Infinity Loop? With My 3D Context Free Library
- Revised 3D Context Free DSL Sketch, with Mouse Whe...
- A Mouse Wheel Listener in Ruby Processing
- 3D Context Free DSL Screen Saver?
- Translating the default.es to ruby processing DSL
- Testing the cube primitive in my context free DSL
- Experimental 3D Context Free DSL in ruby-processin...
- Using the control panel and Toxi Processing Libra...
- Tone map example of Gray-Scott diffusion using tox...
- Another Example of Using Toxi Processing Libraries...
- Using the Toxi Processing Libraries in ruby proces...
-
►
September
(15)
About Me
- monkstone
- Consolidating my online identity as monkstone. I am a 64 bit linux user and advocate of open source software, you can sometimes find me on the processing forum.
0 comments:
Post a Comment