Ripple effect in LCD

Sep 5, 2007 at 3:42pm

Ripple effect in LCD

Hi,

could anyone tell me if there is a more efficient way of making a ripple type effect in LCD than the one in the following code?

Thank you
Chris

max v2;
#N vpatcher 10 59 1024 768;
#P origin -343 -348;
#P button 673 -8 15 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 672 14 66 196617 loadmess 70;
#N vpatcher 134 125 479 552;
#P inlet 140 41 15 0;
#P window setfont “Sans Serif” 9.;
#P newex 205 342 29 196617 gate;
#P newex 91 342 29 196617 gate;
#P newex 194 119 64 196617 random 447;
#P newex 166 119 27 196617 + 1;
#P newex 166 143 38 196617 gate 2;
#P button 209 226 15 0;
#P newex 209 248 61 196617 int 100000;
#P newex 194 270 40 196617 line;
#P newex 80 119 64 196617 random 496;
#P newex 52 119 27 196617 + 1;
#P newex 52 143 38 196617 gate 2;
#P button 95 226 15 0;
#P newex 95 248 61 196617 int 100000;
#P newex 80 270 40 196617 line;
#P inlet 52 41 15 0;
#P inlet 80 41 15 0;
#P inlet 91 319 15 0;
#P outlet 52 312 15 0;
#P outlet 166 312 15 0;
#P connect 4 0 9 0;
#P connect 9 0 8 0;
#P fasten 5 0 1 0 85 299 57 299;
#P connect 8 0 1 0;
#P connect 3 0 10 0;
#P fasten 17 0 10 0 96 364 45 364 45 108 85 108;
#P connect 10 0 8 1;
#P connect 8 1 5 0;
#P connect 2 0 17 0;
#P fasten 8 1 7 0 85 193 100 193;
#P connect 7 0 6 0;
#P connect 6 0 5 1;
#P connect 5 1 17 1;
#P connect 19 0 6 1;
#P fasten 4 0 15 0 57 108 171 108;
#P connect 15 0 14 0;
#P fasten 11 0 0 0 199 299 171 299;
#P connect 14 0 0 0;
#P fasten 3 0 16 0 85 108 199 108;
#P fasten 18 0 16 0 210 363 268 363 268 108 199 108;
#P connect 16 0 14 1;
#P connect 14 1 11 0;
#P fasten 2 0 18 0 96 337 210 337;
#P fasten 14 1 13 0 199 193 214 193;
#P connect 13 0 12 0;
#P connect 12 0 11 1;
#P connect 11 1 18 1;
#P fasten 19 0 12 1 145 108 265 108;
#P pop;
#P newobj 318 68 79 196617 p roaming;
#P toggle 364 28 15 0;
#P toggle 318 9 15 0;
#P newex 548 76 67 196617 unpack 0 0 0;
#P user swatch 548 35 128 32;
#P number 656 78 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 639 79 15 0;
#N vpatcher 162 84 1181 726;
#P origin 5 -111;
#P window setfont “Sans Serif” 9.;
#P number 91 40 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 44 38 15 0;
#P window linecount 0;
#P newex 44 62 64 196617 metro 7000;
#P newex 43 86 52 196617 random 2;
#P inlet 875 176 15 0;
#P inlet 843 176 15 0;
#P inlet 859 176 15 0;
#P window linecount 1;
#P message 161 213 65 196617 clearsprites;
#P button 158 189 15 0;
#P newex 143 163 41 196617 sel 1 0;
#P inlet 23 110 15 0;
#P inlet 6 110 15 0;
#P number 13 261 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 122 169 15 0;
#P button 1201 387 15 0;
#P window linecount 0;
#P message 1201 415 81 196617 deletesprite foo;
#P newex 1186 361 41 196617 sel 1 0;
#P button 964 387 15 0;
#P message 964 415 82 196617 deletesprite eoo;
#P newex 949 361 41 196617 sel 1 0;
#P button 727 387 15 0;
#P message 727 415 82 196617 deletesprite doo;
#P newex 712 361 41 196617 sel 1 0;
#P toggle 1228 281 15 0;
#P toggle 991 281 15 0;
#P toggle 754 281 15 0;
#P newex 868 307 29 196617 gate;
#P newex 830 307 29 196617 gate;
#P newex 792 307 29 196617 gate;
#P newex 754 307 29 196617 gate;
#P newex 1342 307 29 196617 gate;
#P newex 1304 307 29 196617 gate;
#P newex 1266 307 29 196617 gate;
#P newex 1228 307 29 196617 gate;
#P newex 1105 307 29 196617 gate;
#P newex 1067 307 29 196617 gate;
#P newex 1029 307 29 196617 gate;
#P newex 991 307 29 196617 gate;
#P newex 1304 334 27 196617 – 5;
#P newex 1342 334 27 196617 + 5;
#P newex 1228 334 27 196617 – 5;
#P newex 1228 361 194 196617 pack 0 0 0 0 0 0 0;
#P window linecount 2;
#P message 1228 386 210 196617 recordsprite , frameoval $1 $3 $2 $4 $5 $6 $7 0 0 , closesprite foo , drawsprite foo 0 0;
#P window linecount 1;
#P newex 1266 334 27 196617 + 5;
#P newex 1067 334 27 196617 – 5;
#P newex 1105 334 27 196617 + 5;
#P newex 991 334 27 196617 – 5;
#P newex 991 361 194 196617 pack 0 0 0 0 0 0 0;
#P window linecount 2;
#P message 991 386 210 196617 recordsprite , frameoval $1 $3 $2 $4 $5 $6 $7 0 0 , closesprite eoo , drawsprite eoo 0 0;
#P window linecount 1;
#P newex 1029 334 27 196617 + 5;
#P newex 830 334 27 196617 – 5;
#P newex 868 334 27 196617 + 5;
#P newex 754 334 27 196617 – 5;
#P newex 754 361 194 196617 pack 0 0 0 0 0 0 0;
#P window linecount 2;
#P message 754 386 210 196617 recordsprite , frameoval $1 $3 $2 $4 $5 $6 $7 0 0 , closesprite doo , drawsprite doo 0 0;
#P window linecount 1;
#P newex 792 334 27 196617 + 5;
#P number 90 140 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 490 387 15 0;
#P message 490 415 82 196617 deletesprite coo;
#P newex 475 361 41 196617 sel 1 0;
#P button 253 387 15 0;
#P message 253 415 82 196617 deletesprite boo;
#P newex 238 361 41 196617 sel 1 0;
#P button 16 387 15 0;
#P message 16 415 82 196617 deletesprite aoo;
#P newex 1 361 41 196617 sel 1 0;
#P toggle 517 281 15 0;
#P toggle 280 281 15 0;
#P toggle 43 281 15 0;
#P button 24 185 15 0;
#P toggle 43 138 15 0;
#P newex 43 162 58 196617 metro 500;
#P button 43 186 15 0;
#P newex 43 237 1199 196617 sel 1 2 3 4 5 6;
#N counter 0 6;
#X flags 0 0;
#P newobj 43 211 66 196617 counter 0 6;
#P newex 157 307 29 196617 gate;
#P newex 119 307 29 196617 gate;
#P newex 81 307 29 196617 gate;
#P newex 43 307 29 196617 gate;
#P newex 631 307 29 196617 gate;
#P newex 593 307 29 196617 gate;
#P newex 555 307 29 196617 gate;
#P newex 517 307 29 196617 gate;
#P newex 394 307 29 196617 gate;
#P newex 356 307 29 196617 gate;
#P newex 318 307 29 196617 gate;
#P newex 280 307 29 196617 gate;
#P newex 593 334 27 196617 – 5;
#P newex 631 334 27 196617 + 5;
#P newex 517 334 27 196617 – 5;
#P newex 517 361 194 196617 pack 0 0 0 0 0 0 0;
#P window linecount 2;
#P message 517 386 210 196617 recordsprite , frameoval $1 $3 $2 $4 $5 $6 $7 0 0 , closesprite coo , drawsprite coo 0 0;
#P window linecount 1;
#P newex 555 334 27 196617 + 5;
#P newex 356 334 27 196617 – 5;
#P newex 394 334 27 196617 + 5;
#P newex 280 334 27 196617 – 5;
#P newex 280 361 194 196617 pack 0 0 0 0 0 0 0;
#P window linecount 2;
#P message 280 386 210 196617 recordsprite , frameoval $1 $3 $2 $4 $5 $6 $7 0 0 , closesprite boo , drawsprite boo 0 0;
#P window linecount 1;
#P newex 318 334 27 196617 + 5;
#P newex 119 334 27 196617 – 5;
#P newex 157 334 27 196617 + 5;
#P newex 43 334 27 196617 – 5;
#P newex 43 361 194 196617 pack 0 0 0 0 0 0 0;
#P window linecount 2;
#P message 43 386 210 196617 recordsprite , frameoval $1 $3 $2 $4 $5 $6 $7 0 0 , closesprite aoo , drawsprite aoo 0 0;
#P window linecount 1;
#P newex 81 334 27 196617 + 5;
#P inlet 176 281 15 0;
#P inlet 100 281 15 0;
#P inlet 138 281 15 0;
#P inlet 62 281 15 0;
#P outlet 913 583 15 0;
#P connect 41 0 44 0;
#P connect 35 0 97 0;
#P connect 44 1 46 0;
#P connect 46 0 45 0;
#P connect 107 0 106 0;
#P connect 98 0 39 0;
#P connect 39 0 38 0;
#P connect 38 0 37 0;
#P connect 37 0 35 0;
#P connect 40 0 35 0;
#P connect 35 0 36 0;
#P connect 36 0 41 0;
#P connect 41 0 31 0;
#P connect 31 0 8 0;
#P connect 8 0 7 0;
#P connect 7 0 6 0;
#P connect 108 0 107 0;
#P connect 1 0 31 1;
#P connect 5 0 7 1;
#P fasten 41 0 32 0 48 301 86 301;
#P connect 32 0 5 0;
#P connect 39 0 35 3;
#P connect 96 0 35 3;
#P connect 99 0 53 0;
#P connect 53 0 38 1;
#P connect 109 0 107 1;
#P connect 3 0 32 1;
#P connect 10 0 7 2;
#P fasten 41 0 33 0 48 301 124 301;
#P connect 33 0 10 0;
#P connect 9 0 7 3;
#P connect 2 0 33 1;
#P connect 39 0 100 0;
#P fasten 41 0 34 0 48 301 162 301;
#P connect 34 0 9 0;
#P connect 100 1 101 0;
#P connect 101 0 102 0;
#P connect 104 0 7 4;
#P connect 4 0 34 1;
#P connect 103 0 7 5;
#P connect 105 0 7 6;
#P connect 42 0 47 0;
#P connect 47 1 49 0;
#P connect 49 0 48 0;
#P connect 36 1 42 0;
#P connect 42 0 23 0;
#P connect 23 0 14 0;
#P connect 14 0 13 0;
#P connect 13 0 12 0;
#P connect 8 0 23 1;
#P connect 11 0 13 1;
#P connect 42 0 24 0;
#P connect 24 0 11 0;
#P connect 5 0 24 1;
#P connect 16 0 13 2;
#P connect 42 0 25 0;
#P connect 25 0 16 0;
#P connect 15 0 13 3;
#P connect 10 0 25 1;
#P connect 42 0 26 0;
#P connect 26 0 15 0;
#P connect 104 0 13 4;
#P connect 9 0 26 1;
#P connect 103 0 13 5;
#P connect 105 0 13 6;
#P connect 43 0 50 0;
#P connect 50 1 52 0;
#P connect 52 0 51 0;
#P connect 36 2 43 0;
#P connect 43 0 27 0;
#P connect 27 0 20 0;
#P connect 20 0 19 0;
#P connect 19 0 18 0;
#P connect 14 0 27 1;
#P connect 17 0 19 1;
#P connect 43 0 28 0;
#P connect 28 0 17 0;
#P connect 11 0 28 1;
#P connect 22 0 19 2;
#P connect 43 0 29 0;
#P connect 29 0 22 0;
#P connect 21 0 19 3;
#P connect 16 0 29 1;
#P connect 43 0 30 0;
#P connect 30 0 21 0;
#P connect 104 0 19 4;
#P connect 15 0 30 1;
#P connect 103 0 19 5;
#P connect 105 0 19 6;
#P connect 84 0 87 0;
#P connect 87 1 89 0;
#P connect 89 0 88 0;
#P connect 36 3 84 0;
#P connect 84 0 80 0;
#P connect 80 0 57 0;
#P connect 57 0 56 0;
#P connect 56 0 55 0;
#P connect 20 0 80 1;
#P connect 54 0 56 1;
#P fasten 84 0 81 0 759 301 797 301;
#P connect 81 0 54 0;
#P connect 17 0 81 1;
#P connect 59 0 56 2;
#P fasten 84 0 82 0 759 301 835 301;
#P connect 82 0 59 0;
#P connect 58 0 56 3;
#P connect 22 0 82 1;
#P fasten 84 0 83 0 759 301 873 301;
#P connect 83 0 58 0;
#P connect 104 0 56 4;
#P connect 21 0 83 1;
#P connect 103 0 56 5;
#P connect 102 0 0 0;
#P connect 6 0 0 0;
#P connect 12 0 0 0;
#P connect 18 0 0 0;
#P connect 45 0 0 0;
#P connect 48 0 0 0;
#P connect 51 0 0 0;
#P connect 88 0 0 0;
#P connect 55 0 0 0;
#P connect 91 0 0 0;
#P connect 61 0 0 0;
#P connect 67 0 0 0;
#P connect 94 0 0 0;
#P connect 105 0 56 6;
#P connect 85 0 90 0;
#P connect 90 1 92 0;
#P connect 92 0 91 0;
#P connect 36 4 85 0;
#P connect 85 0 72 0;
#P connect 72 0 63 0;
#P connect 63 0 62 0;
#P connect 62 0 61 0;
#P connect 57 0 72 1;
#P connect 60 0 62 1;
#P connect 85 0 73 0;
#P connect 73 0 60 0;
#P connect 54 0 73 1;
#P connect 65 0 62 2;
#P connect 85 0 74 0;
#P connect 74 0 65 0;
#P connect 64 0 62 3;
#P connect 59 0 74 1;
#P connect 85 0 75 0;
#P connect 75 0 64 0;
#P connect 104 0 62 4;
#P connect 58 0 75 1;
#P connect 103 0 62 5;
#P connect 105 0 62 6;
#P connect 86 0 93 0;
#P connect 93 1 95 0;
#P connect 95 0 94 0;
#P connect 36 5 86 0;
#P connect 86 0 76 0;
#P connect 76 0 69 0;
#P connect 69 0 68 0;
#P connect 68 0 67 0;
#P connect 63 0 76 1;
#P connect 66 0 68 1;
#P connect 86 0 77 0;
#P connect 77 0 66 0;
#P connect 60 0 77 1;
#P connect 71 0 68 2;
#P connect 86 0 78 0;
#P connect 78 0 71 0;
#P connect 70 0 68 3;
#P connect 65 0 78 1;
#P connect 86 0 79 0;
#P connect 79 0 70 0;
#P connect 104 0 68 4;
#P connect 64 0 79 1;
#P connect 103 0 68 5;
#P connect 105 0 68 6;
#P pop;
#P newobj 639 153 179 196617 p ripple;
#P button 167 12 34 0;
#P comment 204 14 95 196617 start sprite moving;
#P newex 631 184 60 196617 loadmess 1;
#P window linecount 2;
#P message 396 211 210 196617 recordsprite , frameoval $1 $3 $2 $4 $5 $6 $7 0 0 , closesprite ooo , drawsprite ooo 0 0;
#P toggle 631 206 15 0;
#P window linecount 1;
#P message 631 224 83 196617 enablesprites $1;
#P message 631 247 63 196617 clearsprites;
#P newex 482 130 31 196617 + 10;
#P number 482 152 65 9 0 780 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname number[2];
#P newex 406 130 31 196617 + 10;
#P number 406 152 65 9 0 780 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname number[1];
#P newex 396 187 238 196617 pack 0 0 0 0 0 0 0;
#P message 220 248 33 196617 clear;
#P newex 318 130 48 196617 pack 0 0;
#P number 356 108 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 318 108 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 318 152 76 196617 getpixel $1 $2;
#P user lcd 212 274 500 450 0 1 0 0 1;
#P window linecount 2;
#P comment 820 156 183 196617 < <<<< is there a more efficient way of doing this?;
#P fasten 13 0 1 0 636 243 217 243;
#P fasten 12 0 1 0 636 268 217 268;
#P fasten 2 0 1 0 323 243 217 243;
#P connect 6 0 1 0;
#P fasten 15 0 1 0 401 268 217 268;
#P connect 19 0 1 0;
#P connect 27 0 24 0;
#P connect 24 0 26 0;
#P connect 26 0 3 0;
#P connect 3 0 5 0;
#P connect 5 0 2 0;
#P connect 18 0 26 1;
#P connect 26 1 4 0;
#P connect 4 0 5 1;
#P connect 27 0 25 0;
#P connect 25 0 26 2;
#P fasten 3 0 7 0 323 126 401 126;
#P connect 7 0 15 0;
#P fasten 3 0 9 0 323 126 411 126;
#P connect 9 0 8 0;
#P fasten 8 0 7 1 411 177 439 177;
#P fasten 4 0 7 2 361 126 477 126;
#P fasten 4 0 11 0 361 126 487 126;
#P connect 11 0 10 0;
#P fasten 10 0 7 3 487 177 515 177;
#P connect 22 0 23 0;
#P connect 23 0 7 4;
#P connect 23 1 7 5;
#P connect 23 2 7 6;
#P connect 16 0 14 0;
#P connect 14 0 13 0;
#P connect 27 0 20 0;
#P connect 20 0 19 0;
#P connect 27 0 21 0;
#P connect 21 0 19 1;
#P connect 28 0 27 0;
#P connect 3 0 19 2;
#P connect 8 0 19 3;
#P connect 4 0 19 4;
#P connect 11 0 19 5;
#P connect 23 0 19 6;
#P connect 23 1 19 7;
#P connect 23 2 19 8;
#P pop;

#33543
Sep 5, 2007 at 4:33pm

i don’t know about “ripples” but from a glance at you patch i see
that you are constantly creating and deleting sprites, thats somewhat
against the idea of them.
you should build them in advance and then just draw and hide them at
various positions as needed.

t.

#111832
Sep 5, 2007 at 4:51pm

#111833
Sep 5, 2007 at 9:39pm

thats great. thank you very much.

Chris

#111834
Sep 6, 2007 at 9:31pm

Quote: Chris Hipgrave wrote on Wed, 05 September 2007 15:39
—————————————————-
> thats great. thank you very much.
>
> Chris
—————————————————-

watch out, “clearsprites” in this example depends on the right to left order. ;)

#111835
Sep 6, 2007 at 10:03pm

It may not have the aesthetic you’re going for, but there are a
couple really nifty ripple patches in the examples folder.

examples/jitter-examples/other/pool.pat and pool-with-sound.pat
examples/jitter-examples/render/pool-3d-nurbs.pat

And there is xray.jit.water (see maxobjects.com). I used it for a
gig last night and it worked really well. :) I drew shapes into the
matrix with jit.lcd.

hth,
dan

#111836

You must be logged in to reply to this topic.