Skip to content

Instantly share code, notes, and snippets.

@kmancher
Created September 15, 2017 16:57
Show Gist options
  • Select an option

  • Save kmancher/0b32b339498aeeccb203d029aa29bfc9 to your computer and use it in GitHub Desktop.

Select an option

Save kmancher/0b32b339498aeeccb203d029aa29bfc9 to your computer and use it in GitHub Desktop.
ask question
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