handPose = ml5.handPose();
video = createCapture(VIDEO);
handPose.detectStart(video, gotHands);
textFont("Cherry Bomb One");
drawingContext.shadowOffsetX = 2;
drawingContext.shadowOffsetY = -2;
drawingContext.shadowBlur = 5;
drawingContext.shadowColor = 'rgb(0,0,0)'
image(video, 0, 0, width, height);
for (let i = 0; i < hands.length; i++) {
if (hand.keypoints.length > 19) {
createVector(hand.keypoints[8].x, hand.keypoints[8].y),
createVector(hand.keypoints[4].x, hand.keypoints[4].y),
createVector(hand.keypoints[12].x, hand.keypoints[12].y),
createVector(hand.keypoints[8].x, hand.keypoints[8].y),
createVector(hand.keypoints[16].x, hand.keypoints[16].y),
createVector(hand.keypoints[12].x, hand.keypoints[12].y),
createVector(hand.keypoints[20].x, hand.keypoints[20].y),
createVector(hand.keypoints[16].x, hand.keypoints[16].y),
function gotHands(results) {
function drawTextLine(start_point, end_point, _text, _c) {
let w = textWidth(_text);
let l = start_point.dist(end_point);
let scale_factor = (l - w) / (_text.length - 1);
let mid_point = p5.Vector.lerp(start_point, end_point, 0.5);
let angle = atan2(end_point.y - start_point.y, end_point.x - start_point.x);
translate(mid_point.x, mid_point.y);
for (let i = 0; i < _text.length; i++) {
text(_text[i], index, 0);
index += textWidth(_text[i]) + scale_factor;