Jump to content
Search Community

InsenseVN

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by InsenseVN

  1. Hi, I wasn't able to reproduce, everything looks correct... Actually, I was expecting a different error, since Svelte can run both in the browser & the server, usually, you need to limit your code to a browser environment. Here's my usual setup: import Counter from './Counter.svelte'; import welcome from '$lib/images/svelte-welcome.webp'; import welcome_fallback from '$lib/images/svelte-welcome.png'; import gsap from 'gsap'; import { onDestroy, onMount } from 'svelte'; let context:any; let tl: GSAPTimeline; // Specifies this is running in the browser onMount(() => { context = gsap.context(() => { tl = gsap.timeline(); tl.to({}, {}); }); }); onDestroy( ()=> { if(typeof context !== 'undefined'){ context.revert(); tl.clear(); } } ); Of course, this would work without gsap.context but I have struggled in the past when having different animations across multiple components & pages, so that approach helps me keep everything tidy I haven't found a way to specify a type f or context though. It seems it should be let context:Context2 but I haven't found a way to import the Context2 type
  2. Hi Rodrigo Thanks for the welcome! That was the first thing I tried actually & when it didn't work, I tried other solutions but after reading your reply, here's what worked for me in SvelteKit import type GSAPTimeline from 'gsap'; //Alternatively, depending... import GSAPTimeline from 'gsap';
  3. Thanks! What would the import paths be though for GSAPTimeline? I couldn't find any so I did the following in a SvelteKit typescript project, GSAP 3.12.2 let tl:gsap.core.Timeline
×
×
  • Create New...