From c27b349668f29eaffdf316da5222c75f0c0eb439 Mon Sep 17 00:00:00 2001 From: Skyler Lehmkuhl Date: Wed, 11 Dec 2024 15:10:57 -0500 Subject: [PATCH] Add convenience method to reverse a bezier curve --- src/bezier.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/bezier.js b/src/bezier.js index 6b12ce6..363e602 100644 --- a/src/bezier.js +++ b/src/bezier.js @@ -1998,6 +1998,14 @@ class Bezier { return `<[${this.points[0].x},${this.points[0].y}], [${this.points[1].x},${this.points[1].y}], [${this.points[2].x},${this.points[2].y}], [${this.points[3].x},${this.points[3].y}]` } + reverse() { + return new Bezier( + this.points[3].x, this.points[3].y, + this.points[2].x, this.points[2].y, + this.points[1].x, this.points[1].y, + this.points[0].x, this.points[0].y) + } + } export { Bezier };