Convert scroll animations from AnimeJS to GSAP#11
Conversation
Co-authored-by: PGSCOM <69808296+PGSCOM@users.noreply.github.com>
Co-authored-by: PGSCOM <69808296+PGSCOM@users.noreply.github.com>
|
🚀 Preview Publicada: |
|
Errores en la animacion de secuencia de imagenes + video: Las imagenes no estan animadas de la misma forma que antes, el video no se reproduce despues de la animacion. |
Al volverlo a mirar ahora parece que está arreglado. Probablemente fue por culpa de la cache de mi navegador |
There was a problem hiding this comment.
Pull request overview
This pull request migrates scroll-driven animations from AnimeJS to GSAP for improved performance and cleaner implementation, particularly on mobile devices.
Changes:
- Replaced AnimeJS with GSAP (v3.12.7) for all scroll animations
- Converted timeline API from
anime.timeline()togsap.timeline()with progress-based scrubbing - Added GPU acceleration configuration for mobile optimization
- Converted duration units from milliseconds to seconds throughout
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/pages/index.astro | Converted main scroll timeline and projects section animations from AnimeJS to GSAP, including API conversions and timing adjustments |
| src/styles/proyectos.css | Updated comment to reflect library change from AnimeJS to GSAP |
| package.json | Added gsap@3.12.7 dependency and removed animejs |
| package-lock.json | Updated lockfile with GSAP dependencies and removed AnimeJS-related packages |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import ScrollTrigger from 'https://cdn.jsdelivr.net/npm/gsap@3.12.7/ScrollTrigger/+esm'; | ||
|
|
||
| // Registrar plugins de GSAP | ||
| gsap.registerPlugin(ScrollTrigger); | ||
|
|
There was a problem hiding this comment.
The ScrollTrigger plugin is imported and registered but never used in the code. The scroll handling is implemented manually using the scroll event listener. Consider removing the unused import and plugin registration to reduce bundle size and avoid confusion.
| import ScrollTrigger from 'https://cdn.jsdelivr.net/npm/gsap@3.12.7/ScrollTrigger/+esm'; | |
| // Registrar plugins de GSAP | |
| gsap.registerPlugin(ScrollTrigger); | |
| // Inicialización de animaciones de scroll con GSAP (sin plugins adicionales) |
| // Declarar el tamaño en vh a partir del tamaño visual actual (incluye transform: scale) | ||
|
|
||
| // Duración total de la timeline en segundos (normalizada a 2 segundos para mapeo con scroll) | ||
| const TIMELINE_DURATION = 2; |
There was a problem hiding this comment.
The TIMELINE_DURATION constant is defined but never used in the code. This appears to be a leftover from the migration process. Consider removing it to keep the code clean, or if it was intended for documentation purposes, add a comment explaining its purpose.
| const TIMELINE_DURATION = 2; |
| import ScrollTrigger from 'https://cdn.jsdelivr.net/npm/gsap@3.12.7/ScrollTrigger/+esm'; | ||
|
|
||
| // Registrar plugins de GSAP | ||
| gsap.registerPlugin(ScrollTrigger); | ||
|
|
There was a problem hiding this comment.
The ScrollTrigger plugin is imported and registered but never used in the projects section code. The scroll handling is implemented manually using the scroll event listener. Consider removing the unused import and plugin registration to reduce bundle size and avoid confusion.
| import ScrollTrigger from 'https://cdn.jsdelivr.net/npm/gsap@3.12.7/ScrollTrigger/+esm'; | |
| // Registrar plugins de GSAP | |
| gsap.registerPlugin(ScrollTrigger); | |
| <script type="module"> | ||
| import anime from 'https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.es.js'; | ||
| import gsap from 'https://cdn.jsdelivr.net/npm/gsap@3.12.7/+esm'; | ||
| import ScrollTrigger from 'https://cdn.jsdelivr.net/npm/gsap@3.12.7/ScrollTrigger/+esm'; |
There was a problem hiding this comment.
The CDN import path for ScrollTrigger appears to be incorrect. The path 'https://cdn.jsdelivr.net/npm/gsap@3.12.7/ScrollTrigger/+esm' should likely be 'https://cdn.jsdelivr.net/npm/gsap@3.12.7/dist/ScrollTrigger.js/+esm' or use the correct jsDelivr ESM syntax. Verify this import path works correctly, as an incorrect path would cause a runtime error when the module is loaded.
| import ScrollTrigger from 'https://cdn.jsdelivr.net/npm/gsap@3.12.7/ScrollTrigger/+esm'; | |
| import ScrollTrigger from 'https://cdn.jsdelivr.net/npm/gsap@3.12.7/dist/ScrollTrigger.js/+esm'; |
| <script type="module"> | ||
| import anime from 'https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.es.js'; | ||
| import gsap from 'https://cdn.jsdelivr.net/npm/gsap@3.12.7/+esm'; | ||
| import ScrollTrigger from 'https://cdn.jsdelivr.net/npm/gsap@3.12.7/ScrollTrigger/+esm'; |
There was a problem hiding this comment.
The CDN import path for ScrollTrigger appears to be incorrect. The path 'https://cdn.jsdelivr.net/npm/gsap@3.12.7/ScrollTrigger/+esm' should likely be 'https://cdn.jsdelivr.net/npm/gsap@3.12.7/dist/ScrollTrigger.js/+esm' or use the correct jsDelivr ESM syntax. Verify this import path works correctly, as an incorrect path would cause a runtime error when the module is loaded.
| import ScrollTrigger from 'https://cdn.jsdelivr.net/npm/gsap@3.12.7/ScrollTrigger/+esm'; | |
| import ScrollTrigger from 'https://cdn.jsdelivr.net/npm/gsap@3.12.7/dist/ScrollTrigger.js/+esm'; |
Migrates all scroll-driven animations from AnimeJS to GSAP for cleaner implementation and better mobile performance.
Changes
Animation Library Migration
anime.timeline()withgsap.timeline()for main scroll timeline and projects sectiontimeline.seek(ms)totimeline.progress(0-1)for smoother scroll scrubbinganime.stagger()calls to GSAP's nativestaggerpropertyMobile Optimizations
gsap.config({ force3D: true })for GPU-accelerated transformsforce3D: trueto individual tweens for hardware accelerationDependencies
gsap@3.12.7animejsScreenshot
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
telemetry.astro.build/usr/local/bin/node node /home/REDACTED/work/pgscom.github.io/pgscom.github.io/node_modules/.bin/astro build(dns block)/usr/local/bin/node node /home/REDACTED/work/pgscom.github.io/pgscom.github.io/node_modules/.bin/astro dev --host 0.0.0.0(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.