]> _ Git - fluidbook-html5.git/commitdiff
wip #7241 @6
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 13 Feb 2025 18:10:09 +0000 (19:10 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 13 Feb 2025 18:10:09 +0000 (19:10 +0100)
js/libs/fluidbook/fluidbook.links.animations.js
js/libs/fluidbook/fluidbook.links.js

index d72918b69060e4a23e88a76c7264b09b3274a84a..b895b552324b36fb50d9570d368b587f601739ea 100644 (file)
@@ -72,10 +72,10 @@ FluidbookLinksAnimations.prototype = {
         var duration = 0.5;
         var usegsap = true;
         var initTransform = $(link).css('transform');
-        if(initTransform==='none'){
-            initTransform='';
-        }else{
-            initTransform+=' ';
+        if (initTransform === 'none') {
+            initTransform = '';
+        } else {
+            initTransform += ' ';
         }
 
         animation = $.extend({}, globalDefault, defaultParams, animation);
@@ -89,9 +89,15 @@ FluidbookLinksAnimations.prototype = {
         to.repeatDelay = parseFloat(animation.repeatdelay);
 
         var css = {};
+        if (animation.borderradius) {
+            css.borderRadius = animation.borderradius;
+        }
         if (animation.filter) {
             css.filter = animation.filter;
         }
+        if (animation.opacity) {
+            css.opacity = animation.opacity;
+        }
         if (animation.align) {
             css.textAlign = animation.align;
         }
@@ -101,7 +107,6 @@ FluidbookLinksAnimations.prototype = {
                 css.backgroundPosition = animation.transformorigin;
             } else {
                 css.transform = initTransform + 'scale(' + animation.scale + ')';
-                console.log(css.transform);
                 css.transformOrigin = animation.transformorigin;
             }
         }
@@ -205,10 +210,14 @@ FluidbookLinksAnimations.prototype = {
             from.display = 'none';
             to.display = 'block';
             to.visibility = 'visible';
-            from.opacity = 0;
+            if (css.opacity !== undefined) {
+                from.opacity = css.opacity;
+            }
             to.opacity = 1;
         } else if (animation.type === 'fadeout') {
-            from.opacity = 1;
+            if (css.opacity !== undefined) {
+                from.opacity = css.opacity;
+            }
             to.opacity = 0;
         } else if (animation.type === "unmask" || animation.type === 'reveal') {
             if (animation.type === 'reveal') {
@@ -437,6 +446,15 @@ FluidbookLinksAnimations.prototype = {
         ease = ease.replace('inout', 'inOut');
         return ease;
     },
+
+    finishAnimations:function(e){
+        if ($(e).data('gsap') == undefined) {
+            return;
+        }
+        $.each($(e).data('gsap'),function(k,a){
+            a.totalProgress(1);
+        });
+    }
 }
 
 
index 745b240cf4a5b66cdea76de86e19228cb58803a5..e03b155311245f1931e9622027d03fa40b01815b 100644 (file)
@@ -121,6 +121,19 @@ FluidbookLinks.prototype = {
             return true;
         });
 
+        $(document).on(this.fluidbook.input.hoverEvent, '[data-display-area]', function () {
+            let s = '[data-id="' + $(this).parent().attr('data-id') + '_da"]';
+            let da = $(s);
+            $this.fluidbook.links.animations.finishAnimations(da);
+            da.css({opacity: $this.fluidbook.settings.linksOpacity / 100});
+            return true;
+        });
+        $(document).on('mouseout', '[data-display-area]', function () {
+            let da = $('[data-id="' + $(this).parent().attr('data-id') + '_da"]');
+            da.css({opacity: 0});
+            return true;
+        })
+
         $(document).on(this.fluidbook.input.clickEvent, '.multimediaContainer[data-click-to-close="1"]', function () {
             $this.fluidbook.menu.closeView();
             return false;
@@ -904,10 +917,10 @@ FluidbookLinks.prototype = {
             }));
         } else {
             timeline.add(gsap.to(el, {
-                duration: speed*this.fluidbook.settings.linkBlinkTime, delay: d, [o]: v1, ease: 'none'
+                duration: speed * this.fluidbook.settings.linkBlinkTime, delay: d, [o]: v1, ease: 'none'
             }));
             timeline.add(gsap.to(el, {
-                duration: speed*this.fluidbook.settings.linkBlinkTime, opacity: 0, ease: 'none', onComplete: _complete
+                duration: speed * this.fluidbook.settings.linkBlinkTime, opacity: 0, ease: 'none', onComplete: _complete
             }));
         }
         timeline.play();