source: imaps-frontend/node_modules/html2canvas/dist/lib/render/bezier-curve.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 5 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.6 KB
Line 
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.isBezierCurve = exports.BezierCurve = void 0;
4var vector_1 = require("./vector");
5var lerp = function (a, b, t) {
6 return new vector_1.Vector(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t);
7};
8var BezierCurve = /** @class */ (function () {
9 function BezierCurve(start, startControl, endControl, end) {
10 this.type = 1 /* BEZIER_CURVE */;
11 this.start = start;
12 this.startControl = startControl;
13 this.endControl = endControl;
14 this.end = end;
15 }
16 BezierCurve.prototype.subdivide = function (t, firstHalf) {
17 var ab = lerp(this.start, this.startControl, t);
18 var bc = lerp(this.startControl, this.endControl, t);
19 var cd = lerp(this.endControl, this.end, t);
20 var abbc = lerp(ab, bc, t);
21 var bccd = lerp(bc, cd, t);
22 var dest = lerp(abbc, bccd, t);
23 return firstHalf ? new BezierCurve(this.start, ab, abbc, dest) : new BezierCurve(dest, bccd, cd, this.end);
24 };
25 BezierCurve.prototype.add = function (deltaX, deltaY) {
26 return new BezierCurve(this.start.add(deltaX, deltaY), this.startControl.add(deltaX, deltaY), this.endControl.add(deltaX, deltaY), this.end.add(deltaX, deltaY));
27 };
28 BezierCurve.prototype.reverse = function () {
29 return new BezierCurve(this.end, this.endControl, this.startControl, this.start);
30 };
31 return BezierCurve;
32}());
33exports.BezierCurve = BezierCurve;
34var isBezierCurve = function (path) { return path.type === 1 /* BEZIER_CURVE */; };
35exports.isBezierCurve = isBezierCurve;
36//# sourceMappingURL=bezier-curve.js.map
Note: See TracBrowser for help on using the repository browser.