New to Processing - Help making rainbow drawer!?
in
Programming Questions
•
8 months ago
Hi, I am trying to make a rainbow drawer so that a line drawn continuously cycles through colours of the rainbow. At the moment I have a program that draws the line as a rainbow, but it doesn't cycle through the colours. I am new to Programming so I'm not sure of the best way to do this but I was thinking of using the color mode 'HSB' to constantly change the hue, is there a way to apply this to the 'whole display' if you get what I mean?
Here is the code I have so far:
- float colourdegrees = 0;
- void setup(){
- size(400,400);
- colorMode(HSB, 360, 100, 100);
- background(360);
- }
- void line() {
- stroke(colourdegrees, 97, 100);
- strokeWeight(16);
- smooth();
- if(mousePressed){
- line(mouseX, mouseY, pmouseX, pmouseY);
- colourdegrees=colourdegrees+1.5;
- if(colourdegrees > 359) {
- colourdegrees = 0;
- }
- }
- }
- void draw() {
- line();
- }
Thanks in advance!
1