Jump to content
Search Community

ThrowPops import Error

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