Jump to content
GreenSock

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

ThrowPops import Error

Recommended Posts

Hi all,

 

I'm trying to use the ThrowPropsPlugin together with the Draggable functionality in my VUEjs website.

However every time I set the property "throwProps" to true I get this error:

 

Uncaught ERROR: No velocity was defined in the throwProps tween of [object Object] property: x



I know there are already other topics with the same subject opened but I've tried the solutions mentioned in there and nothing helped.

 

Here's my code for reference. If anyone could help it would be much appreciated. Thanks!

 

require('../libs/ThrowPropsPlugin')
import Draggable from 'gsap/Draggable'

export default {
  	mounted() {
    	initDraggable()
  	},
 	methods: {
    	initDraggable() {
    		Draggable.create(this.$refs.slider, {
              type: 'x',
              minimumMovement: 10,
              edgeResistance: 0.5,
              throwProps: true,
              bounds: this.$refs.wrapper,
              onDragEnd: function() {
                  console.log('target: ' + ThrowPropsPlugin.getVelocity(this.target, "x"))
              }
            })
   		}
	}
}

 

Link to post
Share on other sites
53 minutes ago, Cat said:

I know there are already other topics with the same subject opened but I've tried the solutions mentioned in there and nothing helped.

 

You should probably mention what you did try, and how you're building site, otherwise we're just shooting in the dark here. 

 

I would start by getting rid of that require statement. You shouldn't mix and match import and require statements like that.

 

Also check out the docs.

https://greensock.com/docs/NPMUsage

 

  • Like 1
Link to post
Share on other sites

I found out what was the error. I was importing the ThrowProps plugin from the "minified" folder of the greensock bonus package and not from the "bonus-files-for-npm-users".

 

Now  it all works fine by importing the file.

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

×