How do I use /plugins/MotionGuidePlugin.js in CreateJS 2.0.0 modules?

518 Views Asked by At

I tried to add plugin using the below code

    import { Tween, Ease } from '@createjs/tweenjs';
    import MotionGuidePlugin from '@createjs/tweenjs/src/plugins/MotionGuidePlugin';


    const tween = Tween.get(this.mySprite, { override: true, pluginData: 'MotionGuide' })

It's not working properly.

1

There are 1 best solutions below

2
Lanny On

I don't see your motion guide data. Have you checked out the demos in GitHub?

Make sure to install the plugin once

createjs.MotionGuidePlugin.install(createjs.Tween);

Then pass motion guide data into the tween:

createjs.Tween.get(ball, {bounce: true, loop:3})
    .to({guide: {path: [100,100, 700,100, 800,250], orient: "fixed"}}, 2000);

Here are a few more demos on CodePen:

If you have specific questions, or a demo you can link to, please update your question, and I can try to answer it.