From: Vincent Vanwaelscappel Date: Fri, 20 Dec 2019 16:12:37 +0000 (+0100) Subject: wait #3291 @2 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=e1e1a3ad6be3a7c867b4367377bf447c207f2cc9;p=fluidbook-html5.git wait #3291 @2 --- diff --git a/js/libs/fluidbook/fluidbook.links.js b/js/libs/fluidbook/fluidbook.links.js index 99c0263b..50486565 100644 --- a/js/libs/fluidbook/fluidbook.links.js +++ b/js/libs/fluidbook/fluidbook.links.js @@ -211,11 +211,9 @@ FluidbookLinks.prototype = { links.prepend('
'); var $this = this; - if (this.fluidbook.datas.linkBlinkTime > 0 && this.fluidbook.datas.mobileLinksRevealAnim) { - setTimeout(function () { - $this.animateLinks(); - }, 650); - } + + this.animateLinks(); + setTimeout(function () { $this.fluidbook.initVideos(); $this.initInlineSlideshows(); @@ -227,6 +225,16 @@ FluidbookLinks.prototype = { this.resize(); }, + animateLinks: function () { + if (this.fluidbook.datas.linkBlinkTime == 0 || this.fluidbook.datas.linkBlinkRepetition == 0 || !this.fluidbook.datas.mobileLinksRevealAnim) { + return; + } + var $this = this; + setTimeout(function () { + $this.doAnimateLinks(); + }, 650); + }, + initAnimatedContentsLinks: function () { if (this.fluidbook.mobilefirst.enabled) { return; @@ -426,7 +434,7 @@ FluidbookLinks.prototype = { return null; }, - animateLinks: function (linksContainer, additionalDelay) { + doAnimateLinks: function (linksContainer, additionalDelay) { var container = $(document); if (linksContainer !== undefined) { container = $(linksContainer); @@ -452,18 +460,61 @@ FluidbookLinks.prototype = { if (animateBookmarks) { - var bookmarks = $("#links .bookmark:not([data-enabled])"); - $(bookmarks).addClass('animating').css('opacity', 1); - TweenMax.to($(bookmarks), $this.fluidbook.datas.linkBlinkTime, { - opacity: 0, delay: 0.1, onComplete: function () { - $(bookmarks).removeClass('animating').css('opacity', '') - } - }); + this._blink($("#links .bookmark:not([data-enabled])")); } }, - animateLink: function (link, additionalDelay) { + _blink: function (el, delay) { + if (delay === undefined || delay == 0) { + this.__blink(el); + return; + } var $this = this; + setTimeout(function () { + $this.__blink(el); + }, delay); + }, + + __blink: function (el) { + var _complete = function () { + el.removeClass('animating').css('opacity', ''); + } + + var speed=0.5; + var timeline = new TimelineMax(); + var repetitions = this.fluidbook.datas.linkBlinkRepetition - 1; + el.addClass('animating'); + var d = 0.1; + if (repetitions > 0) { + el.css('opacity', 0); + timeline.add(TweenMax.to(el, this.fluidbook.datas.linkBlinkTime * speed, { + delay: 0.1, + opacity: 1, + ease: Linear.easeNone + })); + d = 0; + } else { + el.css('opacity', 1); + } + for (var i = 0; i < repetitions; i++) { + timeline.add(TweenMax.to(el, this.fluidbook.datas.linkBlinkTime * speed, { + opacity: 0.5, + ease: Linear.easeNone + })); + timeline.add(TweenMax.to(el, this.fluidbook.datas.linkBlinkTime * speed, { + opacity: 1, + ease: Linear.easeNone + })); + } + timeline.add(TweenMax.to(el, this.fluidbook.datas.linkBlinkTime, { + delay: d, + opacity: 0, + onComplete: _complete + })); + timeline.play(); + }, + + animateLink: function (link, additionalDelay) { if (!$(link).is('.displayArea')) { link = $(link).find('.displayArea'); } @@ -476,21 +527,15 @@ FluidbookLinks.prototype = { } else { delay = parseInt(delay); } - - setTimeout(function () { - $(link).addClass('animating').css('opacity', 1); - TweenMax.to(link, $this.fluidbook.datas.linkBlinkTime, { - opacity: 0, delay: .1, onComplete: function () { - $(link).removeClass('animating').css('opacity', 1) - } - }); - }, delay + additionalDelay); - }, + this._blink($(link), delay + additionalDelay); + } + , triggerLinkById: function (id) { var a = $('.link[data-id="' + id + '"] a:eq(0)'); a.get(0).click(); - }, + } + , initInlineSlideshows: function () { var $__this = this; @@ -509,7 +554,8 @@ FluidbookLinks.prototype = { }); } }); - }, + } + , initSlideshow: function (s) { var $this = this; @@ -545,7 +591,8 @@ FluidbookLinks.prototype = { }, 100); }, parseFloat(this.fluidbook.datas.inlineSlideshowDuration) * 1000)); - }, + } + , resize: function () { var $this = this; @@ -558,17 +605,20 @@ FluidbookLinks.prototype = { .attr('height', ih) .css({width: iw, height: ih, transform: 'scale(' + (1 / $this.fluidbook.resize.bookScale) + ')'}); }); - }, + } + , rolloverEnter: function (iid) { var e = $('[data-id="' + iid + '"]'); e.addClass('animaterollover'); - }, + } + , rolloverLeave: function (iid) { var e = $('[data-id="' + iid + '"]'); e.removeClass('animaterollover'); - }, + } + , resizeIframe: function (height) { var iframe = $('.link iframe').eq(0); var container = iframe.closest('.content'); diff --git a/js/libs/fluidbook/fluidbook.menu.js b/js/libs/fluidbook/fluidbook.menu.js index 7613faf0..0f35f008 100644 --- a/js/libs/fluidbook/fluidbook.menu.js +++ b/js/libs/fluidbook/fluidbook.menu.js @@ -169,7 +169,7 @@ FluidbookMenu.prototype = { $("#view").append('
' + view + '
'); if (animateLinks) { - this.fluidbook.links.animateLinks($("#view"), 500); + this.fluidbook.links.doAnimateLinks($("#view"), 500); } if (callback != undefined) {