Jump to content
Search Community

How to Trigger a Tween.lite animation with a Draggable snap point.

jonpon test
Moderator Tag

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

Hi,

 

new to this framework but it seems really really neat, makes me excited to get in to web animation. Great work Greensock team!

 

I have a question that I suspect is fairly simple, I would like to trigger different tweenlite animations using a draggable button, so that depending on where the draggable object stops, or snaps, it will trigger a new tweenlite object.

 

Hopefully someone can understand my question :) 

I will put it into a codepen but this is my js atm.

 

Draggable.create("#button", {
type:"x",
bounds: document.getElementById("line"),
throwProps: true,
liveSnap: true,
snap:[5, 75, 150, 225, 285],
trigger: document.getElementById("button"),
onDrag: function() {
console.log(this.x)
 
},
onDragEnd:function() {
 
TweenLite.to(sideElement1, 2, {sideElement1, width:"200px", height:"150px"});
 
}
 
});
 
 
 
any help would be greatly appreciated.
would love to be able to contribute to this forum, since this seems to be part of my new work description....
 
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...