From f5e2364e1737240df83b970e31e796b212cd82c2 Mon Sep 17 00:00:00 2001 From: Mladen Date: Fri, 23 Aug 2019 20:12:15 +0200 Subject: [PATCH] Use CSS instead of JS animations for markers and dialogs --- docs/dist/index.html | 2 +- docs/src/js/model/marker.js.html | 71 ++----------------------- docs/src/js/service/dialog.js.html | 23 +------- docs/src/js/service/map.js.html | 4 -- docs/src/js/service/storage.js.html | 3 -- docs/src/js/util.js.html | 46 ++++++++++++++-- gulpfile.js | 2 + src/js/model/marker.js | 81 ++--------------------------- src/js/service/dialog.js | 15 ------ src/js/service/map.js | 4 -- src/js/service/storage.js | 3 -- src/less/animation/_twist.less | 24 +++++++++ src/less/animation/_wobble.less | 22 ++++++++ src/less/dialog.less | 26 ++------- src/less/marker.less | 36 ++++++++++++- 15 files changed, 135 insertions(+), 227 deletions(-) create mode 100644 src/less/animation/_twist.less create mode 100644 src/less/animation/_wobble.less diff --git a/docs/dist/index.html b/docs/dist/index.html index 5802296..7e52f28 100644 --- a/docs/dist/index.html +++ b/docs/dist/index.html @@ -1 +1 @@ -Svg Vector Icons : http://www.onlinewebfonts.com/icon
Loading...
\ No newline at end of file +Svg Vector Icons : http://www.onlinewebfonts.com/icon
Loading...
\ No newline at end of file diff --git a/docs/src/js/model/marker.js.html b/docs/src/js/model/marker.js.html index 054c46a..3d909fb 100644 --- a/docs/src/js/model/marker.js.html +++ b/docs/src/js/model/marker.js.html @@ -120,8 +120,6 @@

ФRuŠKać

  • animateBounce
  • -
  • animateWobble -
  • @@ -182,10 +180,7 @@
    if (!div) { div = self.div = document.createElement('div'); - div.setAttribute('class', 'marker-container'); - if (!self.options.visible) { - div.setAttribute('class', div.getAttribute('class') + ' hidden'); - } + div.setAttribute('class', 'marker-container hidden'); if (!self.pulsate) { self.markerShadow = document.createElement('div'); @@ -223,9 +218,9 @@
    // if this is a regular marker if (!self.pulsate) { - // add wobble animation on enter + // add random timeout on enter setTimeout(function () { - self.animateWobble(); + util.removeClass(self.div, 'hidden'); }, Math.random() * 800 + 200); // Show info Window for desktop @@ -351,9 +346,6 @@
    //clusterer.addMarker(self); setTimeout(function () { util.removeClass(self.div, 'hidden'); - //if (!self.clustered) { - self.animateWobble(); - //} }, Math.random() * 400); } else { //clusterer.removeMarker(self); @@ -478,31 +470,6 @@
    dialog.open(content, self); }; -

    Animate Marker with "Drop" animation

    -

    Marker.prototype.animateDrop = function () {
    dynamics.stop(this.markerWrap);
    dynamics.css(this.markerWrap, {
    'transform': 'scaleY(2) translateY(-' + $('#map').outerHeight() + 'px)',
    'opacity': '1'
    });
    dynamics.animate(this.markerWrap, {
    translateY: 0,
    scaleY: 1.0
    }, {
    type: dynamics.gravity,
    duration: 1800
    });

     dynamics.stop(this.marker);
    - dynamics.css(this.marker, {
    - 'transform': 'none'
    - });
    - dynamics.animate(this.marker, {
    - scaleY: 0.8
    - }, {
    - type: dynamics.bounce,
    - duration: 1800,
    - bounciness: 600
    - });
    -
    - dynamics.stop(this.markerShadow);
    - dynamics.css(this.markerShadow, {
    - 'transform': 'scale(0,0)',
    - });
    - dynamics.animate(this.markerShadow, {
    - scale: 1
    - }, {
    - type: dynamics.gravity,
    - duration: 1800
    - });
    - };
    -

    animateBounce

    @@ -557,38 +524,6 @@
    duration: 500, delay: 150 }); -}; -
    -

    animateWobble

    -
    -

    -

    method
    Marker.prototype.animateWobble() -

    -
    -

    Animate Marker with Wobble animation

    -
    Marker.prototype.animateWobble = function () {
    -    dynamics.stop(this.markerWrap);
    -    dynamics.css(this.markerWrap, {
    -        'transform': 'none'
    -    });
    -    dynamics.animate(this.markerWrap, {
    -        rotateZ: Math.random() * 90 - 45
    -    }, {
    -        type: dynamics.bounce,
    -        duration: 1800
    -    });
    -
    -    dynamics.stop(this.marker);
    -    dynamics.css(this.marker, {
    -        'transform': 'none'
    -    });
    -    dynamics.animate(this.marker, {
    -        scaleX: 0.8
    -    }, {
    -        type: dynamics.bounce,
    -        duration: 800,
    -        bounciness: 1800
    -    });
     };
     
     return Marker;
    diff --git a/docs/src/js/service/dialog.js.html b/docs/src/js/service/dialog.js.html
    index 160205a..2f9a9bc 100644
    --- a/docs/src/js/service/dialog.js.html
    +++ b/docs/src/js/service/dialog.js.html
    @@ -106,8 +106,6 @@ 

    ФRuŠKać

  • close
  • -
  • animateWobble -
  • @@ -213,9 +211,6 @@
    setTimeout(function () { self.dialog.open(gmap, anchor); - setTimeout(function () { - self.animateWobble(); - }, 99) }, 99); },
    @@ -231,23 +226,7 @@
    if (this.dialog.getVisible()) { this.dialog.close(); } -}, -
    -

    animateWobble

    -
    -

    -

    method
    Dialog.prototype.animateWobble() -

    -
    -

    Animate Marker with Wobble animation

    -
    animateWobble: function () {
    -    dynamics.animate(this.container.parentNode, {
    -        rotateZ: Math.random() * 30 - 15
    -    }, {
    -        type: dynamics.bounce,
    -        duration: 1800
    -    })
    -}
    +},
     
         };
     
    diff --git a/docs/src/js/service/map.js.html b/docs/src/js/service/map.js.html
    index cff40c9..a530bc3 100644
    --- a/docs/src/js/service/map.js.html
    +++ b/docs/src/js/service/map.js.html
    @@ -269,10 +269,6 @@ 
    } } - google.maps.event.addListener(marker, 'click', function () { - marker.animateWobble(); - }); - resolve(marker); }) diff --git a/docs/src/js/service/storage.js.html b/docs/src/js/service/storage.js.html index 3def628..1bfbac7 100644 --- a/docs/src/js/service/storage.js.html +++ b/docs/src/js/service/storage.js.html @@ -673,9 +673,6 @@
    item.children.forEach(function (child) { var shoudBeOpaque = category && child.categories.indexOf(category) === -1; child.setOpaque(shoudBeOpaque); - if (!shoudBeOpaque) { - child.animateWobble(); - } }) } }) diff --git a/docs/src/js/util.js.html b/docs/src/js/util.js.html index 00815e4..a0d11b0 100644 --- a/docs/src/js/util.js.html +++ b/docs/src/js/util.js.html @@ -100,6 +100,8 @@

    ФRuŠKać