img = loadImage('rain.jpeg');
img2 = loadImage('flower.png');
img3 = loadImage('unico.png');
img4 = loadImage('mer.png');
img5 = loadImage('pup.jpeg');
img6 = loadImage('kit.jpeg');
img7 = loadImage('mon.jpeg');
img8 = loadImage('egy.jpeg');
img9 = loadImage('ely.jpeg');
img10 = loadImage('star.jpeg');
cards = [img,img2,img3,img4,img5,img6,img7,img8,img9,img10];
createCanvas(windowWidth, windowHeight);
currentImg = random(cards);
image(currentImg, 600, 60);
colorPicker = createColorPicker('#000000');
colorPicker.position(60, 30);
sel.option("Normal Paint Brush (press 'N')");
sel.option("Splatter Brush (press 'S')");
slider = createSlider(1, 100, 20, 1);
slider.position(595, 35);
slider.style('width', '180px');
button = createButton("Save Canvas as Image (press 'i')");
button.position(1100, 35);
button.mousePressed(SaveImage);
text("DRAWSCAPE", 60, 110);
text("Welcome to our online coloring game!\nChoose your colors from the colorpicker\nUse the normal brush or the splatter brush to color the image\nAdjust the thickness of your brushes with the slider\nSave your canvas by hitting 'i'\nChange the image you're coloring over by pressing the space bar",60,150);
text("Brush Thickness (press '+' to increase, '-' to decrease):", 595, 30);
text("Brush Type", 275, 25);
text("Color of brush", 60, 25);
if (mouseIsPressed && mouseY > 100) {
if (sel.value() == "Normal Paint Brush (press 'N')") {
stroke(colorPicker.color());
strokeWeight(slider.value());
line(pmouseX, pmouseY, mouseX, mouseY);
if (sel.value() == "Splatter Brush (press 'S')") {
for (i = 0; i < random(1, 10); i++) {
fill(colorPicker.color());
ellipse(mouseX + random(-10, 10), mouseY + random(-10, 10), slider.value(), slider.value());
var to_save = get(0, 100, width, height - 100);
to_save.save("canvas.png");
if (key == 'n' || key == 'N') {
sel.selected("Normal Paint Brush (press 'N')");
} else if (key == 's' || key == 'S') {
sel.selected("Splatter Brush (press 'S')");
} else if (key == 'e' || key == 'E') {
slider.value(slider.value() + 1);
slider.value(slider.value() - 1);
} else if (key == 'r' || key == 'R') {
var randomColor = "#" + Math.floor(Math.random() * 16777215).toString(16);
colorPicker = createColorPicker(randomColor);
colorPicker.position(10, 50);
} else if (key == 'i' || key == 'I') {
} else if (keyCode == 32) {
currentImg = random(cards);
image(currentImg, 600, 60);