用户:
YDS尹子查看:4 回复:8 评论:4 创建时间:2021-08-17T19:38:09
效果图:

用三个点确定一条曲线
function twoBezier(t, oho, aha, eihei,yy,b) {//t:不用管,是曲线的过程值,从0~1循环建立曲线,eihei,oho,aha:三个点的x、z坐标 yy:y坐标 b:方块
const [x1, y1] = oho;
const [cx, cy] = aha;
const [x2, y2] = eihei;
let x = (1 - t) * (1 - t) * x1 + 2 * t * (1 - t) * cx + t * t * x2;
let y = (1 - t) * (1 - t) * y1 + 2 * t * (1 - t) * cy + t * t * y2;
voxels.setVoxel(x,yy,y,b);
return;
}
for(let i=0;i<1;i+=0.01)
twoBezier(i,[185,228],[233,228],[233,187],24+i*5,"medium_gray");