0
我的三角函数比较弱,因此我不知道如何绘制比实线起点和终点短的线段。画布,绘制线段
http://jsfiddle.net/psycketom/TUyJb/
我都试过了,就是从起点减去目标点的一小部分,但它会导致错误的行。
/*
* this is an excerpt from fiddle, that shows
* the actual calculation functions I have implemented
*/
var target = {
x : width/2 + 60,
y : 20
};
var start = {
x : width/2,
y : height
};
var current = {
x : 0,
y : 0
};
var growth = 0.5;
current.x = start.x - (target.x * growth);
current.y = start.y - (target.y * growth);
我敢打赌,我必须使用sin/cos或三角分支中的其他东西才能正确使用它。但是,由于我的三角几何不是生锈的,但总的来说很脆弱,所以我被卡住了。
我该如何绘制一条适合的目标线?
是的,这使得预期的结果,有没有说明该算法? – jolt