Created
July 24, 2013 14:43
-
-
Save zeroeth/6071238 to your computer and use it in GitHub Desktop.
color fading
This file contains hidden or 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
| color colorOne = color(255, 0, 0); | |
| color colorTwo = color(0, 255, 255); | |
| void setup() { | |
| size(600, 600); | |
| } | |
| void draw() { | |
| // give us a number between 0.0 and 1.0 | |
| float sineWave = sin(frameCount/50.0) * 0.5 + 0.5; | |
| // use that number to select between two colors | |
| color currentColor = lerpColor(colorOne, colorTwo, sineWave); | |
| fill(currentColor); | |
| rect(20, 20, 560, 560); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment