mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-20 22:39:50 -05:00
Clean up Path#smooth() code a bit.
This commit is contained in:
parent
e0fa8e00b1
commit
1cb6a7fc3c
1 changed files with 4 additions and 3 deletions
|
@ -1615,13 +1615,14 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
|
||||||
// Do the actual averaging simply by linearly fading between the
|
// Do the actual averaging simply by linearly fading between the
|
||||||
// overlapping values.
|
// overlapping values.
|
||||||
for (var i = 0, j = size; i < overlap; i++, j++) {
|
for (var i = 0, j = size; i < overlap; i++, j++) {
|
||||||
var f1 = (i / overlap);
|
var f1 = i / overlap,
|
||||||
var f2 = 1 - f1;
|
f2 = 1 - f1,
|
||||||
|
ie = i + overlap,
|
||||||
|
je = j + overlap;
|
||||||
// Beginning
|
// Beginning
|
||||||
x[j] = x[i] * f1 + x[j] * f2;
|
x[j] = x[i] * f1 + x[j] * f2;
|
||||||
y[j] = y[i] * f1 + y[j] * f2;
|
y[j] = y[i] * f1 + y[j] * f2;
|
||||||
// End
|
// End
|
||||||
var ie = i + overlap, je = j + overlap;
|
|
||||||
x[je] = x[ie] * f2 + x[je] * f1;
|
x[je] = x[ie] * f2 + x[je] * f1;
|
||||||
y[je] = y[ie] * f2 + y[je] * f1;
|
y[je] = y[ie] * f2 + y[je] * f1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue