InsenseVN
Content Type
Profiles
Forums
Store
Blog
Product
Showcase
FAQ
Downloads
Posts posted by InsenseVN
-
-
46 minutes ago, Rodrigo said:
Hi @InsenseVN and welcome to the GreenSock forums!
I'm not in front of my computer now but from this
https://github.com/greensock/GSAP/blob/master/types/index.d.ts
I believe the import should be directly from gsap
import { GSAPTimeline } from "gsap";
Typescript is not something I use on a regular basis.
Give that a try and let us know how it works.
Happy Tweening!
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';
- 1
-
On 12/7/2019 at 3:20 PM, OSUblake said:
Make sure for v3 that you DO NOT install @types. That will cause conflicts as the types are already included in the package.
For v3, you don't need use typeof like that. We will need to document how users can use some of the global types like this.
let tl: GSAPTimeline; // also compatible with TimelineLite/TimelineMax let tween: GSAPTween; // also compatible with TweenLite/TweenMax let tweenConfig: GSAPTweenVars = { x: (index: number) => index * 0.5 }; let tlConfig: GSAPTimelineVars = { paused: true }; tl = gsap.timeline(tlConfig); tween = gsap.to(".foo", tweenConfig);
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
Usage with typescript
in GSAP
Posted
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:
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
but I haven't found a way to import the Context2 type