I'm attempting to create a layout that has "tabs within tabs" -- that is, a row of top-level tabs (which is easy to set up) and a set of sub-tabs within a given tab. It appears that tabs are always top-level objects, so I'm trying to use Groups to implement the sub-tabs.
In order for this to work, I need each Group, when activated, to de-activate the other groups. In other words, the controls for only one Group should be displayed at any given time. And in order to do this, I think I probably need to create a ControlListener for each Group and add it to the Group using addListener.
Or at least, that's my current theory. But it doesn't seem to be working. Even after I have added a listener to the Group and put a println statement in the controlEvent method for the listener, no print statement appears. I'm not sure whether clicking on a group header doesn't generate an event at all, or whether it generates an event but I'm not using the right technique to grab the event when it occurs.
I hope all of this is clear. (I'm kinda new to Processing.) Can anyone suggest either a way to grab the event, or, more generally, a nice way to implement tabs within tabs? Thanks!
When a ControlP5 knob has .setDragDirection(Knob.VERTICAL), dragging the mouse downward increases the value -- that is, the knob's indicator arc moves clockwise, and the output value increases. I would like to reverse this. It seems more intuitive to me that when one drags downward, the value ought to
decrease.
Both the promidi and controlP5 libraries define the term Controller. I need to use these two libraries side by side in a project, and I'm not enough of a Java programmer (like, basically, not at all) to know what file(s) to open or how to edit it/them in a reliable manner so as to rename the term in one of the two (probably in promidi, as it's probably simpler and I won't be using so many of its features).
Can anyone enlighten me as to how to do this? Thankin' you!
I'm looking for a way to move an object sloooowly across the window -- and also smooooothly. This would undoubtedly require anti-aliasing, and smooth() doesn't do the job. Here's my test code:
PImage img;
float ctr = 0.0;
void setup() {
size(800, 600);
img = loadImage("foo.jpg");
smooth();
}
void draw() {
background(255, 255, 200);
ctr += 0.01;
translate(ctr, ctr * 0.8);
image (img, 10, 10);
rect (200, 200, 50, 50);
}
What happens with this test is, the displayed objects jerk visibly, either down or to the right, one pixel at a time. I would like to get rid of the jerky, jittery aspect of the motion. (Moving the counter addition into the image() or rect() call itself has no effect -- that seems to be functionally identical to using translate()).
I suppose one answer might be, "Use a new Mac with a Retina display," but I'm hoping to learn a way to make the effect work even on a computer that lacks a totally hi-res display.
Is there any way to make this work? Thanks for any tips!
Newbie question. I'm wanting to learn about how to import and display .svg files, so I created an .svg in OpenOffice Draw, which claims that it can export .svg. However, the data as displayed in Processing looks nothing whatever like it does in OO Draw. This could be because Draw is mangling the data, or because of some file type incompatibility, or because I'm not coding it properly in Processing.
Here's the test image I created in Draw -- four objects:
... and here's what it looks like in Processing, using the simplest possible call to shape():
Quite likely this is user error, but I haven't been able to spot anything in the Processing tutorials or reference that will help me unravel the problem.
I'm trying to put some animation into a background buffer rather than displaying it to the main window (so that I can grab portions of it at arbitrary moments). What I'm doing, at the moment, is displaying colored lines that drift across the screen, using a class I've created for the purpose. I want those lines to go into the background buffer, not the main window.
I've created a PImage called buf. I then do this:
void draw() {
buf.loadPixels();
myLine1.animate();
myLine2.animate();
myLine3.animate();
buf.updatePixels();
}
... but the lines are still showing up in the main window. I don't yet know whether they're even in the buffer; haven't tested that. The question is how to redirect draw() to write data strictly to the buffer.
The only drawing function in the line-drawing class is line(). Here's the method I'm calling in my class:
void show () {
stroke(r, g, b, 65);
strokeWeight(3);
line(x1, y1, z1, x2, y2, z2);
}
I'm sure there's a simple way to do what I want -- I just haven't been able to find it by searching through the reference and tutorials. Suggestions would be much appreciated! Thanks.