mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Update Circles example.
This commit is contained in:
parent
29e27c932e
commit
38a1ce0b6a
1 changed files with 12 additions and 4 deletions
|
@ -6,13 +6,21 @@
|
||||||
<script type="text/javascript">var root = '../../'</script>
|
<script type="text/javascript">var root = '../../'</script>
|
||||||
<script type="text/javascript" src="../../src/load.js"></script>
|
<script type="text/javascript" src="../../src/load.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
|
// All newly created items will receive
|
||||||
|
// these style properties:
|
||||||
|
document.currentStyle = {
|
||||||
|
fillColor: 'white',
|
||||||
|
strokeColor: 'black'
|
||||||
|
};
|
||||||
|
|
||||||
var path;
|
var path;
|
||||||
function onMouseDrag(event) {
|
function onMouseDrag(event) {
|
||||||
if (path) path.remove();
|
if (path) path.remove();
|
||||||
var distance = (event.downPoint - event.point).length;
|
// The radius is the distance between the position
|
||||||
path = new Path.Circle(event.downPoint, distance);
|
// where the user clicked and the current position
|
||||||
path.strokeColor = 'black';
|
// of the mouse.
|
||||||
path.fillColor = 'white';
|
var radius = (event.downPoint - event.point).length;
|
||||||
|
path = new Path.Circle(event.downPoint, radius);
|
||||||
};
|
};
|
||||||
|
|
||||||
function onMouseUp(event) {
|
function onMouseUp(event) {
|
||||||
|
|
Loading…
Reference in a new issue