Jump to content
Search Community

GSAP Draggable instance with parallax effect on object

51North test
Moderator Tag

Go to solution Solved by Rodrigo,

Recommended Posts

I want to create a parallax effect in a Draggable instance, but need some help.

 

I already did setup a codepen with Draggable instance, where you can drag a space background. In front of the space background I have an image of a rocket.

 

Is there a way to add a different drag speed/delay/value to the rocket so it looks like being in front of the background?

 

See the Pen MWZJoWW by Tom51north (@Tom51north) on CodePen

Link to comment
Share on other sites

  • Solution

Hi @51North and welcome to the GreenSock forums!

 

Thanks for being a Club GreenSock member and supporting GreenSock!

 

My approach would be to use a QuickTo instance in the onDrag and onThrowUpdate callbacks:

https://greensock.com/docs/v3/GSAP/gsap.quickTo()

 

Maybe something like this:

See the Pen WNLRdXR by GreenSock (@GreenSock) on CodePen

 

Hopefully this helps.

Happy Tweening!

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...