-
Notifications
You must be signed in to change notification settings - Fork 152
Closed
Description
Trying to assign an ordered list of colors to vertexColors(HColorist clr).
Can't do it by passing a HColorPool since it returns a random color from its list.
Then thought I could use HColorField to have an ordered list of gradients that get passed to vertexColors, but simply substituting the HColorPool var with an HColorField one doesn't work: the output is that my shapes are white. Code being:
HColorPool colors = new HColorPool(#e41a1c, #377eb8, #4daf4a, #984ea3);
HColorField colors2 = new HColorField(diameter)
.addPoint(diameter/2, 0, #e41a1c, 0.5)
.addPoint(diameter, diameter/2, #377eb8, 0.5)
.addPoint(diameter/2, diameter, #4daf4a, 0.5)
.addPoint(0, diameter/2, #984ea3, 0.5)
.fillOnly();
// WORKS, BUT COLOR SEQUENCE IS RANDOM (AS EXPECTED)
HPath diamond = new HPath(POLYGON).vertexColors(colors);
// DOESN'T WORK
HPath diamond = new HPath(POLYGON).vertexColors(colors2);
HDrawable d = innerGroup.add(diamond).anchorAt(H.CENTER).noStroke();
for (int j = 0; j < numVertices; j++) {
diamond.vertex(0, 10);
diamond.vertex(0, -10);
diamond.vertex(10, 0);
diamond.vertex(-10, 0);
}
// ALSO DOESN'T WORK WHEN USING colors2
colors2.applyColor(d);
Any idea how to make HColorField work with vertexColors, or any other way to pass in an ordered list of colors?
Thanks!
Metadata
Metadata
Assignees
Labels
No labels