Linear Gradient for my Buttons ?
in
Programming Questions
•
4 months ago
Hi i tried several ways to get a linear Gradient to my buttons, simple form blue to red ....
i defined a Button class, where the color of the button changes for example when its pushed, including several more things.
Is there a easy way to include a linear gradient for that buttons ?
i defined a Button class, where the color of the button changes for example when its pushed, including several more things.
Is there a easy way to include a linear gradient for that buttons ?
- TempButton(int xPos, int yPos, int buttonWidth, int buttonHeight, int redColor, int greenColor, int blueColor) {
this.x = xPos;
this.y = yPos;
this.w = buttonWidth;
this.h = buttonHeight;
this.r = redColor;
this.g = greenColor;
this.b = blueColor;
this.r_h = this.r + 20;
if(this.r_h > 254) this.r_h = 254;
this.g_h = this.g + 20;
if(this.g_h > 254) this.g_h = 254;
this.b_h = this.b + 20;
if(this.b_h > 254) this.b_h = 254;
}
void render() {
if ((mouseX >= x) && (mouseX <= x+w) && (mouseY >= y) && (mouseY <= y+h)) {
hasFocus = true;
isActive = true;
fill(r_h, g_h, b_h);
stroke(r_h, g_h, b_h);
//drow
rect(x, y, w, h);
1