Jump to content
Search Community

Svelte: ScrollTrigger and from()

joshuua test
Moderator Tag

Go to solution Solved by OSUblake,

Recommended Posts

Hi there,

 

I'm using Svelte (SvelteKit specifically) and am running into an issue when using scrollTrigger with .from().

 

Seems like it's something to do with gsap not being able to detect what the destination values should be for the animations, to() works fine.

That said, Without scrollTrigger applied, the animation works ok.

 

The element just stays stuck at the values provided and doesn't animate. I have verified the trigger with `onEnter: () => console.log('check')`

 

Basic example:

<script>
	import gsap from 'gsap/dist/gsap.js';
	import { ScrollTrigger } from 'gsap/dist/ScrollTrigger.js';
	import { onMount } from 'svelte';
	gsap.registerPlugin(ScrollTrigger);

	onMount(() => {
		gsap.from('#my-elem', {
          	scrollTrigger: '#my-elem'
			x: 100
		});
	});
</script>

 

Link to comment
Share on other sites

46 minutes ago, OSUblake said:

Welcome to the forums @joshuua

 

It sounds like you may have stumbled upon a known regression in 3.9.1. It's fixed in next release, but for now try setting lazy: false on the tween.

Oh my.. Thanks for that @OSUblake, thought I was going crazy! lazy: false has indeed solved it for now.

  • Like 1
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...