Jump to content
Search Community

Do bezier plugin accepts Points?

Raestloz test
Moderator Tag

Recommended Posts

The plugin explorer provided an excellent example of what bezier can do, but it doesn't really explain how to use it.

 

In the example, you simply put arrays with {x:value,y:value}. It doesn't look elegant and is not dynamically-generated-friendly, although it does work.

 

So, questions:

  1. Can I define an array beforehand and use it with bezier? If so, how? I tried it once, but it throws an error saying "bezier property is not found in object"
  2. Can I use Points for the array members? I have not the slightest clue how to dynamically generate an array with "x:" string as the member

Basically, I'm asking for help for how to populate the array required for bezier.

 

EDIT:

As usual, I'm being stratospherically dumb.

 

After rightfully making use of the search function, I found a post with an example of how to use parseBezier (which docs description is far beyond my brain capacity).

 

I apologize for wasting your time again gentlemen, I'm really sorry.

 

2nd EDIT:

The parseBezier is not what I'm looking for. The example below is the answer

Link to comment
Share on other sites

The bezier stuff is meant to be extremely flexible - that's why it uses generic objects. So the properties could be x, y, rotation, myCustomProperty, or whatever. The object's properties must be able to be iterated through, so Point objects won't really work - you can't do a for...in loop on those properties.

 

You can certainly create an array beforehand and pass it to the plugin.

 

For example:

 

var points:Array = [];
points.push({x:100, y:200});
points.push({x:300, y:130});
...

TweenMax.to(myObject, 2, {bezier:points});

 

The error you ran into sounds like maybe you were trying to use TweenLite with bezier but you forgot to activate the BezierPlugin, so TweenLite didn't recognize that special property. Don't forget TweenPlugin.activate([bezierPlugin]);

 

Does that help?

Link to comment
Share on other sites

EDIT:

As usual, I'm being stratospherically dumb.

 

After rightfully making use of the search function, I found a post with an example of how to use parseBezier (which docs description is far beyond my brain capacity).

 

I apologize for wasting your time again gentlemen, I'm really sorry.

No worries. Glad you found what you were looking for.

Link to comment
Share on other sites

I tried to use bezierThrough with a Vector.<Point>, which may explain the problem. I saw the "x:" and "y:" and jump into conclusion that it has something to do with Points

 

As for the activation stuff, it is activated, although it is in a different layer for neater code organization

 

EDIT:

The parseBezier doesn't seem to be the one I'm looking for, but your example is spot on Jack, thanks a lot.

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