diff --git a/examples/Tools/SquareRounded.html b/examples/Tools/SquareRounded.html index e2d9f33c..1b3de8e9 100644 --- a/examples/Tools/SquareRounded.html +++ b/examples/Tools/SquareRounded.html @@ -16,12 +16,6 @@ checkValues(); - project.currentStyle = { - strokeColor: 'black', - strokeWidth: 5, - strokeCap: 'round' - }; - ///////////////////////////////////////////////////////////////////// // Mouse handling @@ -34,17 +28,17 @@ var path; function onMouseDown(event) { - path = new Path(); - path.segments = [event.point, event.point]; + path = new Path({ + segments: [event.point, event.point], + strokeColor: 'black', + strokeWidth: 5, + strokeCap: 'round' + }); prevPoint = path.firstSegment.point; curPoint = path.lastSegment.point; curHandleSeg = null; } - function onMouseUp(event) { - // path.pointsToCurves(0, 0, 1, 0.001); - } - var curPoint, prevPoint, curHandleSeg; function onMouseDrag(event) { var point = event.point; diff --git a/examples/Tools/Stars.html b/examples/Tools/Stars.html index ae32d5f0..89dc175f 100644 --- a/examples/Tools/Stars.html +++ b/examples/Tools/Stars.html @@ -15,8 +15,12 @@ var delta = event.point - event.downPoint; var radius = delta.length; var points = 5 + Math.round(radius / 50); - var position = event.downPoint; - var path = new Path.Star(position, points, radius / 2, radius); + var path = new Path.Star({ + center: event.downPoint, + numPoints: points, + radius1: radius / 2, + radius2: radius + }); path.rotate(delta.angle); // Remove the path automatically before the next mouse drag // event: diff --git a/examples/Tools/Wave.html b/examples/Tools/Wave.html index 9ce7f9aa..b9dcaee2 100644 --- a/examples/Tools/Wave.html +++ b/examples/Tools/Wave.html @@ -23,8 +23,9 @@ var path; function onMouseDown(event) { - path = new Path(); - path.strokeColor = '#000000'; + path = new Path({ + strokeColor: '#000000' + }); } var mul = 1; @@ -34,10 +35,11 @@ if (!values.mouseOffset) step.length = values.offset; - var segment = new Segment(event.point + step); - segment.handleIn = -event.delta * values.curviness; - segment.handleOut = event.delta * values.curviness; - path.add(segment); + path.add({ + point: event.point + step, + handleIn: -event.delta * values.curviness, + handleOut: event.delta * values.curviness + }); mul *= -1; }