#N struct rcurver float x float y float x1 float y1 float ax float
ay float bx float by float zx float zy float r float g float b;
#N canvas -9 19 813 626 10;
#X obj 92 401 cnv 15 461 213 empty empty empty 20 12 0 14 -33289 -66577
0;
#X scalar rcurver 150 439 42 137 -18 141 29 -3 -29 -2 255 40 100 \;
;
#X obj 95 69 loadbang;
#X obj 95 114 draw path M x1 y1 C ax ay bx by zx zy;
#X obj 95 177 draw path M x1 y1 L ax ay M bx by L zx zy;
#X msg 95 156 stroke #ccc \, stroke-dasharray 1 1;
#X obj 95 135 loadbang;
#X scalar rcurver 250 442 23 125 -31 135 23 -9 -28 -5 80 2 150 \;;
#X scalar rcurver 365 445 18 131 -31 135 18 -10 -39 -5 150 6 50 \;
;
#X scalar rcurver 480 441 34 136 -32 143 17 -9 -37 -5 70 255 60 \;
;
#X obj 95 17 struct rcurver float x float y float x1 float y1 float
ax float ay float bx float by float zx float zy float r float g float
b;
#X obj 95 228 draw circle x1 y1 5;
#X obj 95 269 draw circle ax ay 5;
#X obj 95 310 draw circle bx by 5;
#X obj 95 351 draw circle zx zy 5;
#X obj 16 182 loadbang;
#X text 424 112 Raphael Curver;
#X text 424 112 ______________;
#X text 424 322 So \, though it makes this patch easier to write \,
a more powerful method of defining interactive behavior is needed.
;
#X text 575 430 <- Click and drag the white circles;
#X text 424 132 This is an interesting demo for two reasons. First
\, aside from the loadbangs it is completely declarative. We just define
some variables and put them in the drawing instructions. Second \,
this patch is a full port of the Raphael.js demo and it's much shorter.
This is because the mouse interaction with the variables is implicit--
we just define them in the drawing commands and Pd assumes that they
should be clickable.;
#X text 424 232 Unfortunately this isn't a very flexible system. There
are times when you don't want mouse interaction at a variable \, or
would like it for some but not all of them. Or you may want some other
behavior than dragging a vertice of the polygon underneath the mouse.
At present you can't define any other behavior-- only turn off mouse
interaction altogether.;
#X msg 95 90 stroke-width 4 \, stroke-linecap 1 \, stroke r g b \,
fill "";
#X msg 16 203 fill white \, mousedown 1 \, drag 1;
#X obj 95 249 drag-event rcurver x1 y1;
#X text 465 24 Note: this can be improved with a set method for [set]:the
[drag-event] abstraction can be removed;
#X obj 95 289 drag-event rcurver ax ay;
#X obj 95 329 drag-event rcurver bx by;
#X obj 95 373 drag-event rcurver zx zy;
#X connect 2 0 22 0;
#X connect 5 0 4 0;
#X connect 6 0 5 0;
#X connect 11 0 24 0;
#X connect 12 0 26 0;
#X connect 13 0 27 0;
#X connect 14 0 28 0;
#X connect 15 0 23 0;
#X connect 22 0 3 0;
#X connect 23 0 11 0;
#X connect 23 0 12 0;
#X connect 23 0 13 0;
#X connect 23 0 14 0;
