Skip to content

Latest commit

 

History

History
60 lines (49 loc) · 1.85 KB

README.md

File metadata and controls

60 lines (49 loc) · 1.85 KB

🍭 gradient-generator 🎨

java version: 16 language: java 42 login: lduplain

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])

🏗️ Compile

To basically compile program:

./gradlew build

To clean all *.o in project:

./gradlew clean

📚 Usage

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):

example result

⚖️ Copyright

Loïs Duplain (lduplain) © 2021