Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
jonpon

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

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 post
Share on other sites

It seems like you would have seen an error in the console for this.

TweenLite.to(sideElement1, 2, {sideElement1, width:"200px", height:"150px"});

// Should be
TweenLite.to(sideElement1, 2, {width:"200px", height:"150px"});
  • Like 2
Link to post
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.

×