mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-07 13:22:07 -05:00
Prebuilt module for commit f7bb96e8b9
This commit is contained in:
parent
4d0d4fc570
commit
b4fc81e215
5 changed files with 72 additions and 45 deletions
31
dist/docs/assets/js/paper.js
vendored
31
dist/docs/assets/js/paper.js
vendored
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Date: Thu Mar 17 09:48:43 2016 +0100
|
* Date: Thu Mar 17 11:24:20 2016 +0100
|
||||||
*
|
*
|
||||||
***
|
***
|
||||||
*
|
*
|
||||||
|
@ -6449,18 +6449,26 @@ new function() {
|
||||||
|
|
||||||
return { statics: {
|
return { statics: {
|
||||||
|
|
||||||
getLength: function(v, a, b) {
|
getLength: function(v, a, b, ds) {
|
||||||
if (a === undefined)
|
if (a === undefined)
|
||||||
a = 0;
|
a = 0;
|
||||||
if (b === undefined)
|
if (b === undefined)
|
||||||
b = 1;
|
b = 1;
|
||||||
if (a === 0 && b === 1 && Curve.isStraight(v)) {
|
if (Curve.isStraight(v)) {
|
||||||
var dx = v[6] - v[0],
|
var c = v;
|
||||||
dy = v[7] - v[1];
|
if (b < 1) {
|
||||||
|
c = Curve.subdivide(c, b)[0];
|
||||||
|
a /= b;
|
||||||
|
}
|
||||||
|
if (a > 0) {
|
||||||
|
c = Curve.subdivide(c, a)[1];
|
||||||
|
}
|
||||||
|
var dx = c[6] - c[0],
|
||||||
|
dy = c[7] - c[1];
|
||||||
return Math.sqrt(dx * dx + dy * dy);
|
return Math.sqrt(dx * dx + dy * dy);
|
||||||
}
|
}
|
||||||
var ds = getLengthIntegrand(v);
|
return Numerical.integrate(ds || getLengthIntegrand(v), a, b,
|
||||||
return Numerical.integrate(ds, a, b, getIterations(a, b));
|
getIterations(a, b));
|
||||||
},
|
},
|
||||||
|
|
||||||
getTimeAt: function(v, offset, start) {
|
getTimeAt: function(v, offset, start) {
|
||||||
|
@ -6469,15 +6477,16 @@ new function() {
|
||||||
if (offset === 0)
|
if (offset === 0)
|
||||||
return start;
|
return start;
|
||||||
var abs = Math.abs,
|
var abs = Math.abs,
|
||||||
|
epsilon = 1e-12,
|
||||||
forward = offset > 0,
|
forward = offset > 0,
|
||||||
a = forward ? start : 0,
|
a = forward ? start : 0,
|
||||||
b = forward ? 1 : start,
|
b = forward ? 1 : start,
|
||||||
ds = getLengthIntegrand(v),
|
ds = getLengthIntegrand(v),
|
||||||
rangeLength = Numerical.integrate(ds, a, b,
|
rangeLength = Curve.getLength(v, a, b, ds),
|
||||||
getIterations(a, b));
|
diff = abs(offset) - rangeLength;
|
||||||
if (abs(offset - rangeLength) < 1e-12) {
|
if (abs(diff) < epsilon) {
|
||||||
return forward ? b : a;
|
return forward ? b : a;
|
||||||
} else if (abs(offset) > rangeLength) {
|
} else if (diff > epsilon) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var guess = offset / rangeLength,
|
var guess = offset / rangeLength,
|
||||||
|
|
31
dist/paper-core.js
vendored
31
dist/paper-core.js
vendored
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Date: Thu Mar 17 09:48:43 2016 +0100
|
* Date: Thu Mar 17 11:24:20 2016 +0100
|
||||||
*
|
*
|
||||||
***
|
***
|
||||||
*
|
*
|
||||||
|
@ -6449,18 +6449,26 @@ new function() {
|
||||||
|
|
||||||
return { statics: {
|
return { statics: {
|
||||||
|
|
||||||
getLength: function(v, a, b) {
|
getLength: function(v, a, b, ds) {
|
||||||
if (a === undefined)
|
if (a === undefined)
|
||||||
a = 0;
|
a = 0;
|
||||||
if (b === undefined)
|
if (b === undefined)
|
||||||
b = 1;
|
b = 1;
|
||||||
if (a === 0 && b === 1 && Curve.isStraight(v)) {
|
if (Curve.isStraight(v)) {
|
||||||
var dx = v[6] - v[0],
|
var c = v;
|
||||||
dy = v[7] - v[1];
|
if (b < 1) {
|
||||||
|
c = Curve.subdivide(c, b)[0];
|
||||||
|
a /= b;
|
||||||
|
}
|
||||||
|
if (a > 0) {
|
||||||
|
c = Curve.subdivide(c, a)[1];
|
||||||
|
}
|
||||||
|
var dx = c[6] - c[0],
|
||||||
|
dy = c[7] - c[1];
|
||||||
return Math.sqrt(dx * dx + dy * dy);
|
return Math.sqrt(dx * dx + dy * dy);
|
||||||
}
|
}
|
||||||
var ds = getLengthIntegrand(v);
|
return Numerical.integrate(ds || getLengthIntegrand(v), a, b,
|
||||||
return Numerical.integrate(ds, a, b, getIterations(a, b));
|
getIterations(a, b));
|
||||||
},
|
},
|
||||||
|
|
||||||
getTimeAt: function(v, offset, start) {
|
getTimeAt: function(v, offset, start) {
|
||||||
|
@ -6469,15 +6477,16 @@ new function() {
|
||||||
if (offset === 0)
|
if (offset === 0)
|
||||||
return start;
|
return start;
|
||||||
var abs = Math.abs,
|
var abs = Math.abs,
|
||||||
|
epsilon = 1e-12,
|
||||||
forward = offset > 0,
|
forward = offset > 0,
|
||||||
a = forward ? start : 0,
|
a = forward ? start : 0,
|
||||||
b = forward ? 1 : start,
|
b = forward ? 1 : start,
|
||||||
ds = getLengthIntegrand(v),
|
ds = getLengthIntegrand(v),
|
||||||
rangeLength = Numerical.integrate(ds, a, b,
|
rangeLength = Curve.getLength(v, a, b, ds),
|
||||||
getIterations(a, b));
|
diff = abs(offset) - rangeLength;
|
||||||
if (abs(offset - rangeLength) < 1e-12) {
|
if (abs(diff) < epsilon) {
|
||||||
return forward ? b : a;
|
return forward ? b : a;
|
||||||
} else if (abs(offset) > rangeLength) {
|
} else if (diff > epsilon) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var guess = offset / rangeLength,
|
var guess = offset / rangeLength,
|
||||||
|
|
12
dist/paper-core.min.js
vendored
12
dist/paper-core.min.js
vendored
File diff suppressed because one or more lines are too long
31
dist/paper-full.js
vendored
31
dist/paper-full.js
vendored
|
@ -9,7 +9,7 @@
|
||||||
*
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Date: Thu Mar 17 09:48:43 2016 +0100
|
* Date: Thu Mar 17 11:24:20 2016 +0100
|
||||||
*
|
*
|
||||||
***
|
***
|
||||||
*
|
*
|
||||||
|
@ -6449,18 +6449,26 @@ new function() {
|
||||||
|
|
||||||
return { statics: {
|
return { statics: {
|
||||||
|
|
||||||
getLength: function(v, a, b) {
|
getLength: function(v, a, b, ds) {
|
||||||
if (a === undefined)
|
if (a === undefined)
|
||||||
a = 0;
|
a = 0;
|
||||||
if (b === undefined)
|
if (b === undefined)
|
||||||
b = 1;
|
b = 1;
|
||||||
if (a === 0 && b === 1 && Curve.isStraight(v)) {
|
if (Curve.isStraight(v)) {
|
||||||
var dx = v[6] - v[0],
|
var c = v;
|
||||||
dy = v[7] - v[1];
|
if (b < 1) {
|
||||||
|
c = Curve.subdivide(c, b)[0];
|
||||||
|
a /= b;
|
||||||
|
}
|
||||||
|
if (a > 0) {
|
||||||
|
c = Curve.subdivide(c, a)[1];
|
||||||
|
}
|
||||||
|
var dx = c[6] - c[0],
|
||||||
|
dy = c[7] - c[1];
|
||||||
return Math.sqrt(dx * dx + dy * dy);
|
return Math.sqrt(dx * dx + dy * dy);
|
||||||
}
|
}
|
||||||
var ds = getLengthIntegrand(v);
|
return Numerical.integrate(ds || getLengthIntegrand(v), a, b,
|
||||||
return Numerical.integrate(ds, a, b, getIterations(a, b));
|
getIterations(a, b));
|
||||||
},
|
},
|
||||||
|
|
||||||
getTimeAt: function(v, offset, start) {
|
getTimeAt: function(v, offset, start) {
|
||||||
|
@ -6469,15 +6477,16 @@ new function() {
|
||||||
if (offset === 0)
|
if (offset === 0)
|
||||||
return start;
|
return start;
|
||||||
var abs = Math.abs,
|
var abs = Math.abs,
|
||||||
|
epsilon = 1e-12,
|
||||||
forward = offset > 0,
|
forward = offset > 0,
|
||||||
a = forward ? start : 0,
|
a = forward ? start : 0,
|
||||||
b = forward ? 1 : start,
|
b = forward ? 1 : start,
|
||||||
ds = getLengthIntegrand(v),
|
ds = getLengthIntegrand(v),
|
||||||
rangeLength = Numerical.integrate(ds, a, b,
|
rangeLength = Curve.getLength(v, a, b, ds),
|
||||||
getIterations(a, b));
|
diff = abs(offset) - rangeLength;
|
||||||
if (abs(offset - rangeLength) < 1e-12) {
|
if (abs(diff) < epsilon) {
|
||||||
return forward ? b : a;
|
return forward ? b : a;
|
||||||
} else if (abs(offset) > rangeLength) {
|
} else if (diff > epsilon) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var guess = offset / rangeLength,
|
var guess = offset / rangeLength,
|
||||||
|
|
12
dist/paper-full.min.js
vendored
12
dist/paper-full.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue