1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
| var bmap = new BMapGL.Map("allmap"); bmap.centerAndZoom(new BMapGL.Point(116.414, 39.915), 20); bmap.enableScrollWheelZoom(true); bmap.setTilt(20); var keyFrames = [ { center: new BMapGL.Point(116.307092, 40.054922), zoom: 20, tilt: 50, heading: 0, percentage: 0, }, { center: new BMapGL.Point(116.307631, 40.055391), zoom: 21, tilt: 70, heading: 0, percentage: 0.1, }, { center: new BMapGL.Point(116.306858, 40.057887), zoom: 21, tilt: 70, heading: 0, percentage: 0.25, }, { center: new BMapGL.Point(116.306858, 40.057887), zoom: 21, tilt: 70, heading: -90, percentage: 0.35, }, { center: new BMapGL.Point(116.307904, 40.058118), zoom: 21, tilt: 70, heading: -90, percentage: 0.45, }, { center: new BMapGL.Point(116.307904, 40.058118), zoom: 21, tilt: 70, heading: -180, percentage: 0.55, }, { center: new BMapGL.Point(116.308902, 40.055954), zoom: 21, tilt: 70, heading: -180, percentage: 0.75, }, { center: new BMapGL.Point(116.308902, 40.055954), zoom: 21, tilt: 70, heading: -270, percentage: 0.85, }, { center: new BMapGL.Point(116.307779, 40.055754), zoom: 21, tilt: 70, heading: -360, percentage: 0.95, }, { center: new BMapGL.Point(116.307092, 40.054922), zoom: 20, tilt: 50, heading: -360, percentage: 1, }, ]; var opts = { duration: 10000, delay: 3000, interation: "INFINITE", }; var animation = new BMapGL.ViewAnimation(keyFrames, opts); animation.addEventListener("animationstart", function (e) { console.log("start"); }); animation.addEventListener("animationiterations", function (e) { console.log("onanimationiterations"); }); animation.addEventListener("animationend", function (e) { console.log("end"); }); animation.addEventListener("animationcancel", function (e) { console.log("cancel"); }); document.getElementById("start").addEventListener("click", function () { bmap.startViewAnimation(animation); }); document.getElementById("end").addEventListener("click", function () { bmap.cancelViewAnimation(animation); });
|