From: Vincent Vanwaelscappel Date: Tue, 22 Feb 2022 12:51:12 +0000 (+0100) Subject: wait #5118 @0.75 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=c019f84b60f904e6135b86d7f779aee86974f609;p=fluidbook-html5.git wait #5118 @0.75 --- diff --git a/js/libs/fluidbook/fluidbook.links.js b/js/libs/fluidbook/fluidbook.links.js index c73e2a8b..e8772797 100644 --- a/js/libs/fluidbook/fluidbook.links.js +++ b/js/libs/fluidbook/fluidbook.links.js @@ -588,9 +588,7 @@ FluidbookLinks.prototype = { to.repeat = parseInt(animation.repeat); var css = {}; - if (animation.ease === undefined) { - animation.ease = "power1.out"; - } + animation.ease = this.fixEase(); if (animation.rotate !== undefined) { animation.rotation = animation.rotate; } @@ -678,7 +676,7 @@ FluidbookLinks.prototype = { } else if ((animation.direction === 'down' && animation.type === 'unmask') || (animation.direction === 'up' && animation.type === 'reveal')) { top = h; } - var rect = 'rect(' + top + 'px,' + right + 'px,' + bottom + 'px,' + left + 'px);'; + var rect = 'rect(' + top + 'px,' + right + 'px,' + bottom + 'px,' + left + 'px)'; if (animation.type === 'unmask') { to.clip = rect; @@ -757,9 +755,7 @@ FluidbookLinks.prototype = { animation.decimaldigitnumber = parseInt(animation.decimaldigitnumber); animation.letterspacing = parseFloat(animation.letterspacing); - var ea = to.ease.split('.'); - var ease = window[ea[0]][ea[1]]; - + var ease = gsap.parseEase(to.ease); var options = { duration: duration, useEasing: true, @@ -769,9 +765,9 @@ FluidbookLinks.prototype = { decimal: animation.decimalseparator, prefix: animation.prefix, suffix: animation.suffix, - //easingFn: function (t, b, c, d) { - // return b + ease.getRatio(Math.min(1, Math.max(0, t / d))) * c; - //} + easingFn: function (t, b, c, d) { + return b + ease(Math.min(1, Math.max(0, t / d))) * c; + } }; css = { @@ -791,8 +787,7 @@ FluidbookLinks.prototype = { } else if (animation.type === 'draggable') { $(link).css('pointer-events', 'auto'); var draggable = new Draggable(link, { - inertia: true, - type: 'x', onRelease: function () { + inertia: true, type: 'x', onRelease: function () { var d = this; if (animation.drop === 'clickhide') { $('#links .link a').each(function () { @@ -822,11 +817,24 @@ FluidbookLinks.prototype = { } if (usegsap) { to.duration = duration; + console.log(from,to); gsap.fromTo(linkElement, from, to); } this.fluidbook.networkControl.pause((to.delay + duration + 0.5) * 1000); }, + fixEase: function (ease) { + if (ease === undefined) { + ease = "power1.out"; + } + ease = ease.toLowerCase(); + if (ease.indexOf('linear') === 0 || ease.indexOf('power0') === 0) { + ease = 'none'; + } + ease = ease.replace('.ease', '.'); + return ease; + }, + getLinkDataById: function (uid) { return this.fluidbook.settings.linksData[uid]; },