mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -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" src="../../src/load.js"></script>
|
||||
<script type="text/paperscript" canvas="canvas">
|
||||
// All newly created items will receive
|
||||
// these style properties:
|
||||
document.currentStyle = {
|
||||
fillColor: 'white',
|
||||
strokeColor: 'black'
|
||||
};
|
||||
|
||||
var path;
|
||||
function onMouseDrag(event) {
|
||||
if (path) path.remove();
|
||||
var distance = (event.downPoint - event.point).length;
|
||||
path = new Path.Circle(event.downPoint, distance);
|
||||
path.strokeColor = 'black';
|
||||
path.fillColor = 'white';
|
||||
// The radius is the distance between the position
|
||||
// where the user clicked and the current position
|
||||
// of the mouse.
|
||||
var radius = (event.downPoint - event.point).length;
|
||||
path = new Path.Circle(event.downPoint, radius);
|
||||
};
|
||||
|
||||
function onMouseUp(event) {
|
||||
|
|
Loading…
Reference in a new issue