mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
7c423190d4
1 changed files with 11 additions and 11 deletions
|
@ -22,19 +22,16 @@
|
||||||
var gradientColor = new GradientColor(gradient, point, point + [radius, 0]);
|
var gradientColor = new GradientColor(gradient, point, point + [radius, 0]);
|
||||||
path.fillColor = gradientColor;
|
path.fillColor = gradientColor;
|
||||||
|
|
||||||
tool.eventInterval = 30;
|
var mouseDown = false,
|
||||||
|
mousePoint = view.center;
|
||||||
var mouseDown = false;
|
|
||||||
|
|
||||||
function onMouseDown(event) {
|
function onMouseDown(event) {
|
||||||
point = point + vector;
|
|
||||||
mouseDown = true;
|
mouseDown = true;
|
||||||
|
mousePoint = event.point;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onMouseDrag(event) {
|
function onMouseDrag(event) {
|
||||||
point = point + (event.point - point) / 10;
|
mousePoint = event.point;
|
||||||
gradientColor.hilite = point;
|
|
||||||
iterate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onMouseUp(event) {
|
function onMouseUp(event) {
|
||||||
|
@ -43,8 +40,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFrame() {
|
function onFrame() {
|
||||||
if (!mouseDown)
|
iterate();
|
||||||
iterate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var grow = false;
|
var grow = false;
|
||||||
|
@ -58,8 +54,12 @@
|
||||||
} else if (!grow && vector.length < 75) {
|
} else if (!grow && vector.length < 75) {
|
||||||
grow = true;
|
grow = true;
|
||||||
}
|
}
|
||||||
vector.length += (grow ? 1 : -1);
|
if (mouseDown) {
|
||||||
vector.angle += 5;
|
point = point + (mousePoint - point) / 10;
|
||||||
|
} else {
|
||||||
|
vector.length += (grow ? 1 : -1);
|
||||||
|
vector.angle += 5;
|
||||||
|
}
|
||||||
gradientColor.hilite = mouseDown ? point : point + vector;
|
gradientColor.hilite = mouseDown ? point : point + vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue