I have this function:
Expand|Select|Wrap|Line Numbers
- function startAnimation() {
- lastVertex = 0;
- k=0;
- i = 0;
- step = 5;
- tick = 10;
- stepnum=0;
- speed = "";
- eol=poly.Distance();
- map.setCenter(poly.getVertex(0),16);
- map.addOverlay(new GMarker(poly.getVertex(0),G_START_ICON));
- map.addOverlay(new GMarker(poly.getVertex(poly.getVertexCount()-1),G_END_ICON));
- if (supportsCanvas) {
- marker = new ELabel(poly.getVertex(0), '<canvas id="carcanvas" width="32" height="32"><\/canvas>',null,new GSize(-16,16));
- map.addOverlay(marker);
- canvas = document.getElementById("carcanvas").getContext('2d');
- var p0 = poly.getVertex(0);
- var p1 = poly.getVertex(1);
- angle = bearing(p0,p1);
- plotcar();
- } else {
- marker = new GMarker(poly.getVertex(0),{icon:car});
- map.addOverlay(marker);
- }
- poly2 = new GPolyline([poly.getVertex(0), poly.getVertex(1), poly.getVertex(2)], 0,0);
- // map.addOverlay(poly2);
- setTimeout("animate(0)",2000); // Allow time for the initial map display
- }
Expand|Select|Wrap|Line Numbers
- <input type="button" onclick="startAnimation()" value="Show Bus Route 1" style="width:120px; height:24px; text-align:center">
If you want to see it in action, it's here
Is there some way that that button click can say "stop the first one and start the next one"?
thanks for your help.