Created
September 15, 2017 16:57
-
-
Save kmancher/0b32b339498aeeccb203d029aa29bfc9 to your computer and use it in GitHub Desktop.
ask question
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
| var input, button, greeting; | |
| function setup() { | |
| // create canvas | |
| createCanvas(710, 400); | |
| input = createInput(); | |
| input.position(20, 85); | |
| button = createButton('ask'); | |
| button.position(input.x + input.width + 10, input.y); | |
| button.mousePressed(answer); | |
| greeting = createElement('h1', 'Find your answer'); | |
| greeting.position(20, 5); | |
| textAlign(CENTER); | |
| textSize(50); | |
| } | |
| function answer() { | |
| var question = input.value(); | |
| input.value(''); | |
| var answer | |
| for (var i=0; i<500; i++) { | |
| push(); | |
| fill(random(150,255)); | |
| translate(random(width), random(height)); | |
| rotate(random(2*PI)); | |
| text(question, 0, 0); | |
| pop(); | |
| } | |
| answer = createElement('h1', 'The future is what you believe'); | |
| answer.position(20, 100); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment