gradient-generator is a small java library to create custom gradients using java.awt.Color.
Created by Loïs Duplain. (42login: lduplain, 42mail: [email protected])
To basically compile program:
./gradlew build
To clean all *.o in project:
./gradlew clean
Example:
public static void main(String[] args) {
Gradient gradient = new Gradient();
gradient.getColors().add(Color.YELLOW);
gradient.getColors().add(Color.ORANGE);
gradient.getColors().add(Color.RED);
gradient.getColors().add(Color.MAGENTA);
gradient.getColors().add(Color.BLUE);
for (int i = 0; i < 1920; i++) {
Color color = gradient.getColor(i, 1920);
// 'color' variable now contains the color at the position 'i'
// in a gradient of size '1920'
}
}
Result (run library to see it):
Loïs Duplain (lduplain) © 2021