Step 4Tweaks to Tweak
After you've had your fun tweaking, there's a good chance you want to disable the additional window so that it doesn't show up when presenting your sketch. You may notice that Tweak first checks for "tweak_hasBeenInitialized" before displaying the Tweak Panel. You can fool tweak into thinking that it has already created the window and keep it from showing up by setting tweak_hasBeenInitialized to true before you instantiate and Tweak type variables.
Here, we modify the example from step 2 to disable the Tweak Panel window.
--------------------------------
TweakInt myNumberR;
TweakInt myNumberG;
TweakInt myNumberB;
void setup(){
// a hack to hide the Tweak Control Panel:
// (placed before any variables are constructed).
tweak_hasBeenInitialized = true;
myNumberR = new TweakInt("Background Red", 100, 1, 0, 255);
myNumberG = new TweakInt("Background Green", 100, 1, 0, 255);
myNumberB = new TweakInt("Background Blue", 100, 1, 0, 255);
}
void draw(){
background(myNumberR.val, myNumberG.val, myNumberB.val);
}
--------------------------------
There's a lot more you can do. Have fun and let us know what cool stuff you do with it. Happy Tweaking!
| « Previous Step | Download PDFView All Steps | Next Step » |
![]() |
Add Comment
|








































