我想用鼠标移动一个圆圈,但在一个较大的圆圈内。
function Update(){
var mx = event.clientX;//mouse X
var my = event.clientY;
var cir1 = circles[0]; //smaller circle
var cir2 = circles[1]; //largee circle
//cir1 pos = mouse pos;
if(mouse is out of larger cir2) cir1 stop moving with mouse and be at the circumference of cir2
}
图像会更好地说明我想要什么 enter image description here