Jump to content

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

motionPath and dragging

Recommended Posts

Hi there,


I'm very familiar with the tweening properties of the greensock package, but I've never used the motion path capabilities. I'm currently faced with developing a mini-game that allows a user to drag a sprite along pre-defined paths. The paths can be dynamically generated, but are more complicated than a simple arc, they are more like S-shapes. In addition, there are points where other paths intersect, so the sprite needs to smoothly jump onto another path when encountering these intersections, based on the vector of the mouse movement.


So basically I'm wondering if this can be accomplished using the motion path capabilities of Greensock before I spend loads of time trying to develop it. If some generous soul can glance at this problem and give me and a quick yay or nay, I would be grateful.


I've attached a sketch of what I mean. The red shape is dragged along the path towards the black squares.



Link to comment
Share on other sites

thanks for the clear explanation. the image was super helpful.


the MotionPaths are meant for simple shapes like rectangles and circles. using LinePath2D you can create a number of line segments between points. None of these are going to get you the nice smooth curves you are after. (unless you pass a zillion points into LinePath2D).


The Bezier and BezierThrough plugins will allow you to tween an object along a curved line. These plugins do not render curved line (although you can pass the points into a method that will utilize the drawing api / graphics methods to do that).


As far as having the object move in the proper direction based on mouse dragging and detecting when paths intersect, there is a ton of custom coding that you will have to do.


Frankly, I would have to recommend that you look to other tools for what you need :(

Link to comment
Share on other sites

Thank you for your reply, Carl! Much appreciated. I'll keep looking around for a solution.

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.