permutations of pixel combinations
in
Programming Questions
•
1 year ago
So I have this so far,
- void setup() {
- size(400,400);
- background(0);
- frameRate(1000000);
- }
- int C=0;
- int D=0;
- int E=0;
- void draw(){
- colorMode(HSB, 255);
- background(C,D,E);
- C=C+1;
- if(C>255){
- D=D+1;
- C=0;
- }
- if(D>255){
- E=E+1;
- D=0;
- }
- if(E>255){
- E=0;
- }
- }
this cycles through all the possible colors that can be produced in the program(~16,000000), and sets each as the background. what I actually want to do is to cycle a pixel through all color combinations, and when it reaches a max value it will reset itself and the next pixel will increment its color by one in the same fashion, until the second pixel is incremented to it's maximum at which point the first two will be reset to zero, and the third will be incremented by one as well, and so on until all the pixels are done. It's basically counting in base 16,000,000 represented visually.
EDIT: I honestly have no idea where to go from there. any help is appreciated.
EDIT2: after further work I came up with this. first pixel is cycling, i have yet to see red, or movement in subsequent pixels
- void setup() {
- size(400,400);
- background(0);
- frameRate(1000000);
- loadPixels();
- }
- void draw(){
- colorMode(HSB, 255);
- {
- pixels[0]=pixels[0]+1;
- for(int i=0; i<pixels.length;i++){
- if(pixels[i]>(16581375)){
- pixels[i+1]=pixels[i+1]+1;
- pixels[i]=0;
- }
- }
- }
- updatePixels ();
- }
1