Rainbow controller??

Apr 6, 2007 at 2:06pm

Rainbow controller??

I am just looking for a function which would linearly walk through the
rainbow colors, preferably with a smooth luminance.
I want to use it within a JSUI, and thus a javascript method would be
nice. I patched something in plain Max, which could explain what I am
after, but its neither elegant nor keeps the luminance smooth…

I just wonder if there is a common method to do this in javascript…

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 327 59 107 196617 split 84 111;
#P newex 235 59 90 196617 split 56 83;
#P message 359 160 74 196617 brgb $1 0 255;
#P newex 327 129 95 196617 scale 84 111 255 0;
#P newex 424 129 105 196617 scale 112 127 0 176;
#P message 283 160 74 196617 brgb 0 $1 255;
#P message 207 160 74 196617 brgb 0 255 $1;
#P newex 235 129 90 196617 scale 56 83 0 255;
#P newex 143 129 90 196617 scale 28 55 255 0;
#P message 131 160 74 196617 brgb $1 255 0;
#P newex 55 130 85 196617 scale 0 27 0 255;
#P newex 143 59 90 196617 split 28 55;
#P user hslider 55 33 21 362 128 1 0 0;
#P newex 55 59 86 196617 split 0 27;
#P message 55 160 74 196617 brgb 255 $1 0;
#P user panel 67 214 128 128;
#X brgb 255 0 0;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P connect 3 0 2 0;
#P connect 2 0 5 0;
#P connect 5 0 1 0;
#P connect 13 0 0 0;
#P connect 10 0 0 0;
#P connect 9 0 0 0;
#P connect 6 0 0 0;
#P connect 1 0 0 0;
#P connect 7 0 6 0;
#P connect 2 1 4 0;
#P connect 4 0 7 0;
#P connect 8 0 9 0;
#P connect 4 1 14 0;
#P connect 14 0 8 0;
#P connect 12 0 10 0;
#P connect 14 1 15 0;
#P connect 15 0 12 0;
#P connect 11 0 13 0;
#P connect 15 1 11 0;
#P window clipboard copycount 16;


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com

#31228
Apr 6, 2007 at 2:31pm

On 06 Apr 2007, at 16:06, Stefan Tiedje wrote:

> I am just looking for a function which would linearly walk through
> the rainbow colors, preferably with a smooth luminance.
> I want to use it within a JSUI, and thus a javascript method would
> be nice. I patched something in plain Max, which could explain what
> I am after, but its neither elegant nor keeps the luminance smooth…
>
> I just wonder if there is a common method to do this in javascript…

maybe you mean to cycle through the hue values?
on http://www.easyrgb.com/math.html you can find pseudo code for all
sorts of format conversions, including hsl to rgb.
this is easily adjusted for javascript.
or you can use the hue message to the colorswatch to convert to rgb
values.
vb

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P hidden newex 213 65 72 196617 loadmess 128;
#P hidden newex 199 47 72 196617 loadmess 255;
#P window setfont “Sans Serif” 18.;
#P comment 314 355 21 196626 B;
#P comment 276 355 21 196626 G;
#P comment 240 355 21 196626 R;
#P window setfont “Sans Serif” 9.;
#P number 305 341 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 269 341 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 233 341 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 233 318 82 196617 unpack i i i;
#P number 145 91 35 9 0 255 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 109 91 35 9 0 255 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 73 91 35 9 0 255 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont “Sans Serif” 18.;
#P comment 153 62 21 196626 L;
#P comment 113 62 21 196626 S;
#P window setfont “Sans Serif” 9.;
#P newex 92 305 68 196617 prepend brgb;
#P user panel 92 329 128 128;
#X brgb 255 0 0;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P newex 92 145 61 196617 prepend hsl;
#P user swatch 92 167 181 127;
#P newex 92 122 52 196617 pak 0 0 0;
#P window setfont “Sans Serif” 18.;
#P comment 75 62 21 196626 H;
#P window setfont “Sans Serif” 10.;
#P comment 184 90 100 196618 0 – 255 (8-bit);
#P hidden connect 20 0 11 0;
#P hidden connect 19 0 10 0;
#P connect 3 0 6 0;
#P fasten 3 0 12 0 97 300 238 300;
#P connect 2 0 4 0;
#P connect 9 0 2 0;
#P connect 10 0 2 1;
#P connect 11 0 2 2;
#P connect 4 0 3 0;
#P connect 6 0 5 0;
#P connect 12 0 13 0;
#P connect 12 1 14 0;
#P connect 12 2 15 0;
#P window clipboard copycount 21;

#101160
Apr 7, 2007 at 1:09pm

#101161

You must be logged in to reply to this topic.