Processing 使用p5js在两个ml5js poseNet关键点之间移动对象

Processing 使用p5js在两个ml5js poseNet关键点之间移动对象,processing,p5.js,pose-estimation,Processing,P5.js,Pose Estimation,我试着在两个身体关键点之间做一个圆周运动,即左肩和右肩之间。我从这段代码开始,让一个对象跟随某个位置: var-rectLocation; var x=50; 变量y=50; 函数设置(){ createCanvas(640400); rectLocation=createVector(宽度/2,高度/2); } 函数绘图(){ 背景(255); var target=createVector(x,y); var距离=目标距离(rectLocation); var mappedDistance

我试着在两个身体关键点之间做一个圆周运动,即左肩和右肩之间。我从这段代码开始,让一个对象跟随某个位置:

var-rectLocation;
var x=50;
变量y=50;
函数设置(){
createCanvas(640400);
rectLocation=createVector(宽度/2,高度/2);
}
函数绘图(){
背景(255);
var target=createVector(x,y);
var距离=目标距离(rectLocation);
var mappedDistance=映射(距离,100,0,1.5,0.5);
target.sub(rectLocation);
target.normalize();
target.mult(映射距离);
rectLocation.add(目标);
文本('hello',rectLocation.x,rectLocation.y);
x=x+1;
如果(x>宽度){
x=50;
}
}