sizeSlider = createSlider(0, width / 2, width / 4);
sizeSlider.position(width / 2 +110, windowHeight * 7 / 8);
sizeSlider.style("width", "400px");
saveButton = createButton('SAVE')
saveButton.position(360, 47)
saveButton.style('color', '#fff');
saveButton.style('font-size', '16px');
saveButton.style('background-color', '#f0553a');
saveButton.style('border', 'none');
saveButton.mousePressed(savePicture);
video = createCapture(VIDEO);
video.size(windowWidth, windowHeight);
handpose = ml5.handpose(video, modelLoaded);
videoBuffer = createGraphics(800, 800);
frameBuffer = createGraphics(800, 800);
drawBuffer = createGraphics(800, 800);
image(videoBuffer, 0, 0);
image(frameBuffer, 0, 0);
text(day() + "." + month() + "." + year(), 650, 70)
function drawColorBar() {
btnRed = createButton('')
btnOrange = createButton('')
btnOrange.position(0, height / 6)
btnYellow = createButton('')
btnYellow.position(0, height / 3)
btnGreen = createButton('')
btnGreen.position(0, height / 2)
btnBlue = createButton('')
btnBlue.position(0, height / 1.5)
btnPurple = createButton('')
btnPurple.position(0, height / 1.2)
btnArr = [btnRed, btnOrange, btnYellow, btnGreen, btnBlue, btnPurple]
const colorArr = ['red', 'orange', 'yellow', 'green', 'blue', 'purple']
btnArr.forEach((btn) => {
btn.style('border', 'none');
btn.style('color', '#fff');
btn.style('background-color', colorArr[i])
penColor = String(colorArr[x])
videoBuffer.image(video, 0, 0, width, height);
input = sizeSlider.value();
if (lastInput != input) {
frameBuffer.fill(220, 240);
frameBuffer.rectMode(CENTER);
frameBuffer.rect(width / 2, height / 2, 800, 800, sizeSlider.value());
drawBuffer.fill(penColor);
drawBuffer.ellipse(mouseX, mouseY, 20, 20);
if (hands && hands.length > 0) {
drawBuffer.fill(penColor);
drawBuffer.ellipse(hands[0].landmarks[8][0]+50, hands[0].landmarks[8][1]+70, 20, 20);
console.log('Handpose loaded!');
handpose.on('predict', gotHands);
function gotHands(results) {