Last active
March 18, 2016 18:43
-
-
Save benjavides/0eb120aceb04cd4cf5d8 to your computer and use it in GitHub Desktop.
Encargo 1 Benjamín Benavides Medialab 2016-1
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
| // Código de P5JS | |
| var img; | |
| var a; | |
| draw_mode = false; | |
| var display; | |
| var texto; | |
| function preload() { | |
| if (draw_mode==true){ | |
| img = loadImage("assets/bowie.jpg"); | |
| } | |
| } | |
| function setup() { | |
| createCanvas(400, 400); | |
| background("white"); | |
| } | |
| function draw() { | |
| if (draw_mode){ | |
| image(img, 0, 0); | |
| fill("red"); | |
| textSize(12); | |
| update_text(); | |
| display = text(texto, 300, 20); | |
| } | |
| // Dibujo | |
| noStroke(); | |
| fill("orange"); | |
| triangle(137,200,150,232,130,242); | |
| triangle(241,185,261,226,234,221); | |
| fill(color(249,243,221)); | |
| rect(147,212,90,100); | |
| triangle(39,325,191,251,359,314); | |
| quad(39,324,358,313,396,400,4,400); | |
| fill(color(240,231,185)); | |
| quad(132,87,241,87,259,158,124,158); | |
| quad(133,170,249,166,239,222, 141,222) | |
| quad(124,158,259,158,237,183,142,184); | |
| quad(141,222,239,222,207,254,175,253) | |
| fill("red"); | |
| quad(179,87,229,87,177,145,140,171); | |
| triangle(164,152,213,120,149,220) | |
| fill("blue"); | |
| triangle(168,87,179,87,140,171); | |
| triangle(154,163,164,154,149,220); | |
| fill("orange"); | |
| quad(105,54,142,14,123,165,112,149); | |
| quad(141,14,234,4,241,87,132,87); | |
| triangle(233,4,274,60,240,87); | |
| quad(240,86,273,60,277,143,261,172); | |
| } | |
| // Para mostrar coordenadas del mouse | |
| function update_text(){ | |
| texto = "("+str(mouseX)+" , "+str(mouseY)+")"; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment