Last active
December 12, 2015 02:19
-
-
Save hilukasz/4698364 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup(){ | |
makeTransition(fromRGB, toRGB, 1000); | |
//exit(); | |
} | |
int time = 1000; | |
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 | |
print("from: " +fromRGB[i]); println(", to: " +toRGB[i]); | |
if(fromRGB[i] != toRGB[i]){ // make sure they are not already at correct R, G, B | |
if(fromRGB[i] > toRGB[i]){ | |
fromRGB[i]--; | |
} else { fromRGB[i]++;} | |
println(fromRGB[i]); | |
} | |
} | |
delay(time); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment