good, thanks @jeremydouglass , but doing the outline is only one question,
how can a group ( of shapes ( even if closed )) be treated like a closed shape and filled??
PShape l1,l2,l3,l4,all;
int w=100;
void setup(){
size(300,300);
all = createShape(GROUP);
l1 = createShape(LINE,0,0,w,0);
l2 = createShape(LINE,w,0,w,w);
l3 = createShape(LINE,w,w,0,w);
l4 = createShape(LINE,0,w,0,0);
all.addChild(l1);
all.addChild(l2);
all.addChild(l3);
all.addChild(l4);
//all.fill(0,200,0); // fill() can only be called between beginShape() and endShape()
}
void draw(){
background(200,200,0);
fill(0,200,0); // not change
//all.setFill(0, 200); // ERROR This renderer does not support setFill() for individual vertices
shape(all,width/2,height/2);
}
i have no idea??
only for a single vertex shape the dynamic fill works for me
PShape s;
void segment(float in_r,float out_r, float start_p,float stop_p){
s = createShape();
s.beginShape();
float rx,ry;
for ( float f = start_p ; f < stop_p ; f+=(stop_p-start_p)/360){
rx = in_r * sin(f);
ry = in_r * cos(f);
s.vertex(rx,ry);
}
rx = in_r * sin(stop_p);
ry = in_r * cos(stop_p);
s.vertex(rx,ry);
rx = out_r * sin(stop_p);
ry = out_r * cos(stop_p);
s.vertex(rx,ry);
for ( float f = stop_p ; f > start_p ; f-=(stop_p-start_p)/360){
rx = out_r * sin(f);
ry = out_r * cos(f);
s.vertex(rx,ry);
}
rx = in_r * sin(start_p);
ry = in_r * cos(start_p);
s.vertex(rx,ry);
s.endShape(CLOSE); //
}
void setup() {
size(300, 300,P2D);
segment(50,90,PI*0.2,PI*1.7);
}
void draw() {
background(200,200,0);
shape(s, width/2, height/2);
s.setFill(color(255-mouseY, mouseX, 255));
// s.setStroke(false);
}