Jump to content
Search Community

Using Greensock as a CDN or local?

andrewandopen test
Moderator Tag

Recommended Posts

Hey all,

Pretty new to GSAP, using it on a site I've just built for a client that heavily relies on scroll trigger and physics plugins.

Is it safer for me to link all of my GSAP files locally than by using a CDN – at leat for the main gsap lib and scrolltrigger (physics plugin is always local). 

Thanks in advance!

 

Link to comment
Share on other sites

There are various opinions about this, not a "right" or "wrong" answer. My personal preference is to leverage the CDN when you can because they're optimized for load speed and can (in some browsers) leverage an already-cached version of the file. But it's totally fine to just load them off your own server. That way you're not affected by any CDN outages (they're quite rare, but can happen). 

  • Like 1
Link to comment
Share on other sites

Thank so much for your quick reply jack, much appreciated.

While I have you here, something I'd like to ask re scrolltrigger –  is it possible to link two animations to one trigger? Currently I have 2 timelines with 2 triggers, but the trigger points are at the exact same position on the page. I would like to neaten up my code a bit by having one trigger, but animate both timelines, is this possible? 

Thanks. 

Link to comment
Share on other sites

20 minutes ago, andrewandopen said:

While I have you here, something I'd like to ask re scrolltrigger –  is it possible to link two animations to one trigger? Currently I have 2 timelines with 2 triggers, but the trigger points are at the exact same position on the page. I would like to neaten up my code a bit by having one trigger, but animate both timelines, is this possible? 

Is there a particular reason you didn't just combine them into one timeline? Like...why have two ScrollTriggers and two separate animations instead of one ScrollTrigger with one timeline? Sample code would really help. 👍

  • Like 2
Link to comment
Share on other sites

14 hours ago, GreenSock said:

Is there a particular reason you didn't just combine them into one timeline? Like...why have two ScrollTriggers and two separate animations instead of one ScrollTrigger with one timeline? Sample code would really help. 👍

When I tried this, the second timeline kicked in directly after the first, as opposed to playing at the same time which is what I want. Link here if it helps  , and thank you.

Link to comment
Share on other sites

It's too time-consuming to troubleshoot a live site like that - if you need some help, please provide a minimal demo in CodePen or something like that and we'd be happy to take a peek. 

 

I wonder if you just populated the timeline incorrectly. Remember, by default animations will sequence in a timeline (new things get added to the end), but you can use the position parameter to put them wherever you want. So if you want something to start at the beginning use 0 as the position parameter.

 

 

  • Like 2
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...