lucasvallenet Posted February 20, 2023 Share Posted February 20, 2023 Hello, I'm having an issue with DrawSVG on Firefox in a Nuxt app. This error keeps looping: Uncaught TypeError: y is null Everything works fine during the development, the errors appears on build, in Firefox and in SPA when coming from another page. The code is pretty simple : <template> <div class="c-c2-shapes"> <div v-for="(icon, i) in icons" :key="`c2-shapes-icon-${i}`" class="c-c2-shapes_shape"> <component :is="icon" /> </div> </div> </template> <script> import Vue from 'vue' import { gsap } from 'gsap' import Hole from '~/assets/experience/shapes/hole.svg?inline' import Base from '~/assets/experience/shapes/base.svg?inline' import Square from '~/assets/experience/shapes/square.svg?inline' import Ring from '~/assets/experience/shapes/ring.svg?inline' export default Vue.extend({ name: 'VC2Shapes', components: { Hole, Base, Square, Ring, }, data: () => ({ icons: [ Hole, Base, Square, Ring, Ring, ], animationArray: [], }), mounted() { const $paths = this.$el.querySelectorAll('path') for (const $path of $paths) { this.animationArray.push( gsap.fromTo( $path, { drawSVG: '0%', // Tested drawSVG: 0 }, { drawSVG: '100%', ease: 'none', // scrollTrigger: { // trigger: $path, // endTrigger: this.$el, // start: 'top+=5% bottom', // end: 'top top', // scrub: 1, // }, } ) ) } }, beforeDestroy() { for (const a of this.animationArray) { a.kill() } }, }) </script> It is supposed to play on scroll, but I commented this part because it is not the source of the problem. It might be a Nuxt issue, but I wanted to ask just in case. Thank you very much ! Lucas Link to comment Share on other sites More sharing options...
GSAP Helper Posted February 20, 2023 Share Posted February 20, 2023 It's pretty tough to troubleshoot without a minimal demo - the issue could be caused by CSS, markup, a third party library, your browser, an external script that's totally unrelated to GSAP, etc. Would you please provide a very simple CodePen or CodeSandbox that demonstrates the issue? Please don't include your whole project. Just some colored <div> elements and the GSAP code is best (avoid frameworks if possible). See if you can recreate the issue with as few dependancies as possible. If not, incrementally add code bit by bit until it breaks. Usually people solve their own issues during this process! If not, then at least we have a reduced test case which greatly increases your chances of getting a relevant answer. Here's a starter CodePen that loads all the plugins. Just click "fork" at the bottom right and make your minimal demo: See the Pen aYYOdN by GreenSock (@GreenSock) on CodePen If you're using something like React/Next/Vue/Nuxt or some other framework, you may find StackBlitz easier to use. We have a series of collections with different templates for you to get started on these different frameworks: React/Next/Vue/Nuxt. Once we see an isolated demo, we'll do our best to jump in and help with your GSAP-specific questions. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now