Created
September 15, 2015 04:31
-
-
Save lisajamhoury/7f97bf63bacf6b80bae9 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
var you = "Can you count to 4 million?" | |
var syria = "Since 2011, 3.8 million Syrians have lost their homes. Nearly 200,000 have lost their lives." | |
var count = 1; | |
var countX = 0; | |
var countY = 0; | |
function setup() { | |
createCanvas(800,800) | |
background(255); | |
} | |
function draw() { | |
background(255, 0, 0, 1); | |
fill(32); | |
textSize(24); | |
text(you, 250, 200, 375, 200); | |
textSize(16); | |
fill(208); | |
// darkens 5% of numbers randomly | |
if (floor(random(20)) == 1) { | |
fill(112); | |
} | |
text(count, countX, countY, 20, 20); | |
if (count <= 9) { | |
countX += 10; | |
} | |
if (count > 9 && count < 100) { | |
countX += 20; | |
} | |
if (count > 100 && count < 1000) { | |
countX += 30; | |
} | |
if (count > 1000) { | |
countX += 40; | |
} | |
// resets x and moves y down one line | |
if (countX >= 801) { | |
countX = 0; | |
countY += 20; | |
} | |
count += 1; | |
} | |
function mouseClicked() { | |
fill(32); | |
textSize(24); | |
text(syria, 250, 250, 375, 200); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment