mixing active and static modes
in
Programming Questions
•
8 months ago
I'm trying to make a simple function to transition from one color to another, but I get the error "It looks like you're mixing "active" and "static" modes. Here is the code:
- int[] fromRGB = { 100, 0, 255 };
- int[] toRGB = { 50, 0, 0 };
- void makeTransition(int[] fromRGB, int toRGB, int time){
- for(int i = 0; i < 3; i++){ // loop through R,G,B
- if(fromRGB[i] != toRGB[i]){ // make sure they are not already at correct R, G, B
- if(fromRGB[i] > toRGB[i]){
- fromRGB[i]++;
- println(fromRGB[i]);
- } else { fromRGB[i]--; }
- }
- }
- delay(time);
- }
- makeTransition(fromRGB, toRGB, 1000);
any ideas?
1