Jump to content
GreenSock

danehansen

Use draggable for scrolling/throw props but not actually dragging something...

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

not sure the best way to clearly illustrate what i'm thinking but giving it my best try... i'm wondering if there is a way to use Draggable as the controller for something that is other than an item being dragged or scrolled on stage. specifically what i am after is that i have renderings of a 3D object with rotates 360 degrees. i plan to make a sprite sheet out of that and i figure i could place an invisible Draggable object of the top that when it gets scrolled/thrown, i read out those changes and use it to change which frame of the sprite i am on. is there a way to do this without having a transparent dragging object over the top? and if not, is there a way to have my invisible object be infinitely scrollable or would i just have to size the window as the size of my sprite and then have the thing inside just be 999999999px by 9999999999px? thank you.

Link to comment
Share on other sites

Hi,

 

Draggable has a trigger option that allows you to move the targeted element by using the drag/swipe on another area or element.

 

Check the API docs for more info in the configuration options part:

 

http://api.greensock.com/js/com/greensock/utils/Draggable.html

 

Also here's a very simple example regarding this:

 

See the Pen IiHgq by rhernando (@rhernando) on CodePen

 

Feel free to fork and adapt it to your needs.

 

Rodrigo.

  • Like 3
Link to comment
Share on other sites

That is real cool Jamie.. nice job!

Link to comment
Share on other sites

Cheers guys, thanks to Rodrigo for the idea of using a trigger though.

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