summaryrefslogtreecommitdiff
path: root/snap.html
diff options
context:
space:
mode:
authorCode WvS <code-wvs@quantentunnel.de>2015-03-01 17:48:36 +0100
committerCode WvS <code-wvs@quantentunnel.de>2015-03-01 17:48:36 +0100
commit2a6993efae6e961660ecd2aa1f999f10aadf94f4 (patch)
tree0e17ff542086f2d83c00a1bb63bdb577ece4bd97 /snap.html
parent5b615ebf5cfc4f6aa6c5930dcc7ec7e211e883df (diff)
downloadsnap-yow-2a6993efae6e961660ecd2aa1f999f10aadf94f4.tar.gz
snap-yow-2a6993efae6e961660ecd2aa1f999f10aadf94f4.zip
draw pen trails; expand to polygons automatically
Diffstat (limited to 'snap.html')
-rwxr-xr-xsnap.html11
1 files changed, 10 insertions, 1 deletions
diff --git a/snap.html b/snap.html
index 7f609d0..ab02c64 100755
--- a/snap.html
+++ b/snap.html
@@ -57,7 +57,7 @@
};
// Snap! YOW starts here
- var world, map, layer, spriteGroup;
+ var world, map, layer, spriteGroup, polylines, polylineIndex;
function loop() {
world.doOneCycle();
@@ -115,6 +115,15 @@
window.spriteGroup = spriteGroup;
spriteGroup = L.layerGroup().addTo(map);
+ // During a pen down, a polyline is updated at polylines[this.myPolylineIndex].
+ // On pen up, myPolylineIndex is set to polylineIndex and polylineIndex is incremented
+ // so polylines contains complete lines created by different sprites.
+ // These lines might be (partially) transformed into polygons.
+ window.penTrails = L.layerGroup().addTo(map);
+ window.polylines = polylines;
+ polylineIndex = 0;
+ polylines = [];
+
// Load the IDE
world = new WorldMorph(document.getElementById('world'));
world.worldCanvas.focus();