npm install curve-utils --save
<script src="js/curveUtils.js"></script>
curve functions.you can get the little step of the given path,so you can draw the animated curve. 贝塞尔曲线函数,画贝塞尔曲线动画
inputString: "M0 0L100 0";
inputArray: [
["M", 0, 0],
["L", 100, 0]
];
path2Curve(path: inputContent): inputArray;
getTotalLength(path: inputContent): number;
getPointAtLength(path: inputContent, length: number): {
x: number;
y: number;
};
getSubpathsAtLength(path: string|CurveObject[], ratio: number,justStart:boolean);
-
justStart:true; returns {start:string like "M0 0 C0 0 100 0 100 0",end:""}
-
justStart:false; returns string like "M0 0 C0 0 100 0 100 0"
let mat = martix | new Martix(1, 0, 0, 1, 0, 0);