We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cfec61f commit 9ea2070Copy full SHA for 9ea2070
1 file changed
v3/src/paths/curves/spline/SplineCurve.js
@@ -20,7 +20,41 @@ var SplineCurve = new Class({
20
21
Curve.call(this);
22
23
- this.points = points;
+ // if points is an array of numbers ...
24
+
25
+ this.points = [];
26
27
+ this.addPoints(points);
28
+ },
29
30
+ addPoints: function (points)
31
+ {
32
+ for (var i = 0; i < points.length; i++)
33
34
+ var p = new Vector2();
35
36
+ if (typeof points[i] === 'number')
37
38
+ p.x = points[i];
39
+ p.y = points[i + 1];
40
+ i++;
41
+ }
42
+ else if (Array.isArray(entry))
43
44
+ // An array of arrays?
45
+ p.x = points[i][0];
46
+ p.y = points[i][1];
47
48
+ else
49
50
+ p.x = points[i].x;
51
+ p.y = points[i].y;
52
53
54
+ this.points.push(p);
55
56
57
+ return this;
58
},
59
60
addPoint: function (x, y)
0 commit comments