jsui (javascript) VERY basic question

Kasper's icon

hi

my first try to use jsui - I started by editing (a copy of) the 360° dial (the one which is in the help file), and want to get rid of the background (the white square in which is the dial) - to have just the round dial.

If I got it right the colors are in the RGBA values, and when i can change the color of the background, I can not make it disappear

what i do is messing with
var vbrgb = [1.,1.,1.,1];

changing the values of the first 3 params (RGB) works, when the last one (A) does not seem to make any effect

why is it so? any advice?

many thanks

kasper

/*

360 dial

arguments: fgred fggreen fgblue bgred bggreen bgblue dialred dialgreen dialblue

*/

sketch.default2d();
var val = 0;
var vbrgb = [1.,1.,1.,1];
var vfrgb = [0.2,0.2,0.2,1];
var vrgb2 = [0.7,0.7,0.7,1];
var last_x = 0;
var last_y = 0;

FRid's icon

Hi Kasper,

I think (emphasis on "think" here) that is the alpha-color. Try setting it to zero and my guess is that the color won't show. Or set it to 0.5 and place another object behind it, if my assumptions are correct it will be partially transparent.

HTH,
FRid

Kasper's icon

well yes, i also THOUGHT this.
but doing so i see no difference

i hoped that with alpha at zero and anything behind i would see onlt what is behind. but no

best

kasper

Luke Hall's icon

I think you may be stuck with a white background but other things you draw should be able to have variable opacity. I could be wrong but I remember a discussion about the pros and cons of [jsui] by itself and [js] with [lcd] which can have a transparent background.

mzed's icon

Check out some of the jsui mgraphics examples. They do transparency.

Kasper's icon

mgraphics???

some of your design? could not find what it is.......

any pointer?

thank you

kasper

mzed's icon

Sorry. In the Max examples folder. /Max6/examples/javasript/ui-mgraphics/ holds some patches... look for mgraphics-yellowfade.maxpat.

mz

Kasper's icon

thanks!!!

kasper

keepsound's icon

You have forgot to initialize the other string values. The first are x x x, the second are y y y and so on. That means that the string are in form of "x x x y y y z z z", or better $1 $2 $3 $4 $5 $6 $7 $8 $9.
If you want to change only the first, there's no problem because you have to send only $1 $2 $3, if you want to send two full color parameters, use $1 $2 $3 $4 $5 $6, but if you want to change only the second, change $4 $5 $6 but you have so send $1 $2 $3 too (memorize the values before), etc.
Maximum $ values are 9.