mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-07 13:22:07 -05:00
Add Curve#getPrevious / Next.
This commit is contained in:
parent
de9a406dc0
commit
407b6d8d33
1 changed files with 26 additions and 13 deletions
|
@ -37,19 +37,6 @@ var Curve = this.Curve = Base.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getPath: function() {
|
|
||||||
return this._path;
|
|
||||||
},
|
|
||||||
|
|
||||||
getIndex: function() {
|
|
||||||
return this._index1;
|
|
||||||
},
|
|
||||||
|
|
||||||
_setIndex: function(index) {
|
|
||||||
this._index1 = index;
|
|
||||||
this._updateSegments();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The first anchor point of the curve.
|
* The first anchor point of the curve.
|
||||||
*/
|
*/
|
||||||
|
@ -112,6 +99,32 @@ var Curve = this.Curve = Base.extend({
|
||||||
return this._segment2;
|
return this._segment2;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getPath: function() {
|
||||||
|
return this._path;
|
||||||
|
},
|
||||||
|
|
||||||
|
getIndex: function() {
|
||||||
|
return this._index1;
|
||||||
|
},
|
||||||
|
|
||||||
|
_setIndex: function(index) {
|
||||||
|
this._index1 = index;
|
||||||
|
this._updateSegments();
|
||||||
|
},
|
||||||
|
|
||||||
|
getNext: function() {
|
||||||
|
var curves = this._path && this._path._curves;
|
||||||
|
// TODO: Add cyclic looping when closed back to Scriptographer
|
||||||
|
return curves && (curves[this._index1 + 1]
|
||||||
|
|| this._path.closed && curves[0]) || null;
|
||||||
|
},
|
||||||
|
|
||||||
|
getPrevious: function() {
|
||||||
|
var curves = this._path && this._path._curves;
|
||||||
|
return curves && (curves[this._index1 - 1]
|
||||||
|
|| this._path.closed && curves[curves.length - 1]) || null;
|
||||||
|
},
|
||||||
|
|
||||||
// Calculates arclength of a cubic using adaptive simpson integration.
|
// Calculates arclength of a cubic using adaptive simpson integration.
|
||||||
getLength: function(goal) {
|
getLength: function(goal) {
|
||||||
var z0 = this._segment1._point,
|
var z0 = this._segment1._point,
|
||||||
|
|
Loading…
Reference in a new issue