Jump to content
Search Community

MarcOlmos

Members
  • Posts

    13
  • Joined

  • Last visited

Posts posted by MarcOlmos

  1. Firstly, thank you for answering me.

     

    I am using force3D: true on gsap.config() for Angular.

     

    I am also applying "rotationY" property to try to force GPU rendering.

     

    import { Component, OnInit } from '@angular/core';
    import { gsap } from 'gsap';
    
    gsap.config({
      force3D: true
    })
    
    @Component({
      selector: 'app-tabs',
      templateUrl: './tabs.component.html',
      styleUrls: ['./tabs.component.scss']
    })
    export class TabsComponent implements OnInit {
      ngOnInit(): void {
      }
    
      activateSwitchOnClick(
        partSelected: string,
        otherPart: string
      ) {
        const tl6 = gsap.timeline();
        tl6.to(`.${partSelected}`, {
          duration: 0.5,
          width: 'calc(80% - 10px)',
          backgroundColor: '#FFFFFF',
          pointerEvents: 'none',
          rotationY: 500
        }).to(`.${otherPart}`, {
          duration: 0.5,
          width: 'calc(20% - 10px)',
          backgroundColor: '#0C71C3'
        }, '-=0.5')
          .to(`.${partSelected} .extra-info`, {
            duration: 0.5,
            width: '40%'
          }, '-=0.5')
          .to(`.${otherPart} .extra-info`, {
            duration: 0.5,
            width: '0px'
          }, '-=1')
          .to(`.${otherPart} .extra-info .info-text`, {
            duration: 0.5,
            opacity: 0
          }, '-=1.5')
          .fromTo(`.${partSelected} .extra-info .i1`, {opacity: 0, y: 10}, {opacity: 1, y: 0, duration: 0.3}, '-=0')
          .fromTo(`.${partSelected} .extra-info .i2`, {opacity: 0, y: 10}, {opacity: 1, y: 0, duration: 0.3}, '-=0')
          .fromTo(`.${partSelected} .extra-info .i3`, {opacity: 0, y: 10}, {opacity: 1, y: 0, duration: 0.3}, '-=0')
          .to(`.${otherPart}`, {
            duration: '-=2',
            pointerEvents: 'all'
          })
      }
    
    }

     

    But I can´t see any change on the GPU.
     

    image.png.bb3a1a2c3369d243fe3e0d15d6d05774.png

    Thanks.

  2. There is a carrousel which scrolls horizontally while scrolling down, but inside it there are some <a> tags that doesn't work. It's like the whole component is set as pointer-events: none, but it's not.

     

    https://dev-airnest.web.app/

     

    Here I show my .ts code:

     

    import { Component, OnInit } from '@angular/core';
    import { gsap } from 'gsap';
    import { ScrollTrigger } from 'gsap/ScrollTrigger';
     
    gsap.registerPlugin(ScrollTrigger);
     
    @Component({
    selector: 'app-home',
    templateUrl: './home.component.html',
    styleUrls: ['./home.component.css'],
    })
    export class HomeComponent implements OnInit {
    constructor() {}
     
    ngOnInit(): void {
    gsap.registerPlugin(ScrollTrigger);
     
    if (window.matchMedia('(min-width: 400px)').matches) {
    const home1 = gsap.timeline({
    scrollTrigger: {
    trigger: '.hm1',
    start: 'top 0%',
    end: '+=1300',
    pin: true,
    scrub: 1,
    markers: false,
    },
    });
     
    home1.fromTo('.hc1', { x: '100vw', pointerEvents: 'auto' }, { x: '-100vw', pointerEvents: 'auto' });
    }
    }
    }

     

    This is my .html code:

     

    <div class="hc1 carrousel">
    <a href="https://dev.airnest.es/grancanaria" class="place">
    <div class="place-photo place-photo-1"></div>
    <div class="place-title" id="test">Gran Canaria</div>
    </a>
    <a href="https://dev.airnest.es/tenerife" class="place">
    <div class="place-photo place-photo-2"></div>
    <div class="place-title">Tenerife</div>
    </a>
    <a href="https://dev.airnest.es/fuerteventura" class="place">
    <div class="place-photo place-photo-3"></div>
    <div class="place-title">Fuerteventura</div>
    </a>
    <a href="https://dev.airnest.es/lanzarote" class="place">
    <div class="place-photo place-photo-4"></div>
    <div class="place-title">Lanzarote</div>
    </a>
    <a href="https://dev.airnest.es/lapalma" class="place">
    <div class="place-photo place-photo-5"></div>
    <div class="place-title">La Palma</div>
    </a>
    <a href="https://dev.airnest.es/lagomera" class="place">
    <div class="place-photo place-photo-6"></div>
    <div class="place-title">La Gomera</div>
    </a>
    <a href="https://dev.airnest.es/elhierro" class="place">
    <div class="place-photo place-photo-7"></div>
    <div class="place-title">El Hierro</div>
    </a>
    <a href="https://dev.airnest.es/lagraciosa" class="place">
    <div class="place-photo place-photo-8"></div>
    <div class="place-title">La Graciosa</div>
    </a>
    </div>


    Thanks for the help.

    See the Pen by (@) on CodePen

  3. I've found the solution, thank you!!! :) 

     

     

    // wait until DOM is ready
    document.addEventListener("DOMContentLoaded", function(event) {
      
      console.log("DOM loaded");
      
      // wait until images, links, fonts, stylesheets, and js is loaded
      window.addEventListener("load", function(e) {
        
        // custom GSAP code goes here
         console.log("window loaded");
        
        gsap.registerPlugin(ScrollTrigger);
          
          
        document.getElementById("button").addEventListener("click", function(){ 
            const notifyTL = new TimelineLite({paused: true})
        
            notifyTL.to(".notifyjs-corner", {y: +70})

            var prevScrollpos = window.pageYOffset;

            window.onscroll = function() {
              var currentScrollPos = window.pageYOffset;
              console.log(currentScrollPos);
                if (currentScrollPos > 218) {
                    notifyTL.reverse();        
                } else {
                    notifyTL.play();
                }
            }
        });
        


        
      }, false);
      
    });

  4. Hi,

     

    I've been having problems with an element that appears when a button is clicked.

     

    297149438_Sintitulo-min.thumb.png.3a81fd7e7299a2f2db700b6aa79c4825.png

     

    When I scroll more than X px my navbar height changes, and I would like to do the same with the element to animate. But GSAP doesn't find the target.

     

    1458632116_Capturadepantalla2021-07-08alas9_22.03-min.thumb.png.deee3318f2ba5bc95066c8cc12788831.png

     

     

    How can I make GSAP wait to search for the animation until I click the button of "Adding to the cart"??

     

    Thats my code. 

     

    1647434533_Capturadepantalla2021-07-08alas9_25.06-min.png.89c204a4b5df34dbc0cf1f509ea816af.png

     

    Thanks!!!

     

     

     

     

  5. Hi,

     

    I was trying to created some cool animations using ScrollTrigger, but it doesn't work. The animation plays once the page is loaded.

     

    This is my code:

     

    1373516789_Capturadepantalla2021-07-04alas17_42_35.png.c1d0d6ae8e0b7bbd1d79445eb049eab9.png

     

     

    I would like to add that thanks to the activity of this forum I could integrate GSAP animations to a child theme on Wordpress.

×
×
  • Create New...