xxxxxxxxxx
78
var brush;
var y = 50;
var x = 10;
var s = 40;
var angle = 0.0;
function setup() {
createCanvas(400, 400);
background(255);
textSize(40);
text('🖌️', x, y);
text('🔥', x + 50, y);
text('🔮', x + 100, y);
text('📺', x + 150, y);
text('🌸', x + 200, y);
text('🤠', x + 250, y);
angleMode(DEGREES);
}
function draw() {
//var c = cos(angle)
if (mouseIsPressed) {
if (mouseY > 100) {
textSize(s);
translate(mouseX,mouseY);
rotate(angle);
text(brush, 0, 0);
}
if (mouseY < 60) {
if (mouseX <= 60) {
brush = '🖌️'
}
if ((mouseX > 60) && (mouseX < 110)) {
brush = '🔥';
}
if ((mouseX > 110) && (mouseX < 170)) {
brush = '🔮';
}
if ((mouseX > 170) && (mouseX < 220)) {
brush = '📺'
}
if ((mouseX > 220) && (mouseX < 270)) {
brush = '🌸'
}
if ((mouseX > 270) && (mouseX < 320)) {
brush = '🤠'
}
}
}
if (keyIsPressed) {
if (key == 'r') {
noStroke();
fill = 255;
rect(0, 60, width, height);
}
if (keyCode == UP_ARROW) {
s++;
}
if (keyCode == DOWN_ARROW) {
s--;
}
if (keyCode == RIGHT_ARROW){
angle++;
}
if(keyCode == LEFT_ARROW){
angle--
}
}
}