How to make a simple Switch with canvas?
0 is black,1 is white.
I tried to find something with onCursorDown but...
Switches With canvas
Re: Switches With canvas
Example coming soon-ish
Re: Switches With canvas
Yeah-ish!
Pretty sure that the solution is under my eyes...
Pretty sure that the solution is under my eyes...
Re: Switches With canvas
Sorry for being late-ish...lol
Here you are...colors are provided via custom expressions so you can easily change them - the expression "out" is what you need to "map" to midi or OSC out
Here you are...colors are provided via custom expressions so you can easily change them - the expression "out" is what you need to "map" to midi or OSC out
- Attachments
-
- CanvasSwitch.jzml
- (2.67 KiB) Downloaded 66 times
Re: Switches With canvas
Nice example,thank you!
I never saw and I don't understand this:
canvas_setFillStyle(c,out?oncolor:offcolor);
"?" ":" ????
I never saw and I don't understand this:
canvas_setFillStyle(c,out?oncolor:offcolor);
"?" ":" ????
Re: Switches With canvas
if a then b else c ----> a?b:c (Lemur manual, page 136)
if out is NOT 0 then if(out) returns true - if out=0, then if(out) returns false
so, instead of typing
we type
if out is NOT 0 then if(out) returns true - if out=0, then if(out) returns false
so, instead of typing
Code: Select all
if (out==1) canvas_setFillStyle(c,oncolor);
else canvas_setFillStyle(c,offcolor);
Code: Select all
canvas_setFillStyle(c,out?oncolor:offcolor);
Re: Switches With canvas
As Softcore says, it's in the manual - but the manual doesn't really explain it very well - nowhere near as well as Softcore does himself.
Further reading:
https://en.wikipedia.org/wiki/%3F:
^ You'll have to copy / paste the entirety of the URL as the forum software is mangling the bloody thing - that colon on the end . . . is part of the URL.
Further reading:
https://en.wikipedia.org/wiki/%3F:
^ You'll have to copy / paste the entirety of the URL as the forum software is mangling the bloody thing - that colon on the end . . . is part of the URL.