[Tweener] Tween around circular path
Fred Naude
info at headspacemedia.co.za
Mon Nov 2 12:20:37 PST 2009
Thanks Zeh,
I still seem to be missing some point though.
I have created a class with this code:
package
{
import flash.display.*;
import caurina.transitions.*;
public class CircularTest extends MovieClip
{
var myObject:Object;
var whatever:Whatever = new
Whatever();
protected var
_objectAngle:Number
public function
CircularTest()
{
addChild(whatever);
Tweener.addTween(whatever, {objectAngle: 50, time:1});
}
public function get
objectAngle(): Number
{
return
_objectAngle;
}
public function set
objectAngle(__value:Number): void
{
if
(_objectAngle!= __value) {
_objectAngle= __value;
// Redraw
object
var
radiusX:Number = 10;
var
radiusY:Number = 20;
var
px:Number = Math.cos((_objectAngle / 180) * Math.PI) * radiusX;
var
py:Number = Math.sin((_objectAngle / 180) * Math.PI) * radiusY;
myObject.x =
px;
myObject.y =
py;
}
}
}
}
But I get the following error:
## [Tweener] Error: The property 'objectAngle' doesn't seem to be a normal
object property of [object Whatever] or a registered special property.
What should the property be that I should be using?
Thanks,
Fred
From: tweener-bounces at lists.caurinauebi.com
[mailto:tweener-bounces at lists.caurinauebi.com] On Behalf Of Zeh Fernando
Sent: 02 November 2009 09:24 PM
To: tweener at lists.caurinauebi.com
Subject: Re: [Tweener] Tween around circular path
Oops, the setter should be
public function set objectAngle(__value:Number): void {
instead of just "angle".
Also, you'd use it like...
Tweener.addTween(whatever, {objectAngle: 50, time:1});
Etc.
Zeh
On Mon, Nov 2, 2009 at 2:22 PM, Zeh Fernando <zeh at zehfernando.com> wrote:
That's a way, but personally I believe it's way too wacky.
Personally, independently of the tweening engine used, I'd create a function
that allowed you to project an object on the ellipse then create a
getter/setter and just tween it. Something like
protected var _objectAngle:Number
public function get objectAngle(): Number {
return _objectAngle;
}
public function set angle(__value:Number): void {
if (_objectAngle!= __value) {
_objectAngle= __value;
// Redraw object
var radiusX:Number = 10;
var radiusY:Number = 20;
var px:Number = Math.cos((_objectAngle / 180) * Math.PI) * radiusX;
var py:Number = Math.sin((_objectAngle / 180) * Math.PI) * radiusY;
myObject.x = px;
myObject.y = py;
}
}
Something like that. You may need additional transformation if you want to
rotate the ellipsis itself instead of using simple x/y radius.
Zeh
On Mon, Nov 2, 2009 at 2:09 PM, Fred Naude <info at headspacemedia.co.za>
wrote:
HI there list,
How would I go about tweening an object around an ellipse with tweener?
Is using Bezier points the only way?
Thanks,
Fred
_______________________________________________
Tweener mailing list
Tweener at lists.caurinauebi.com
http://lists.caurinauebi.com/listinfo.cgi/tweener-caurinauebi.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.caurinauebi.com/pipermail/tweener-caurinauebi.com/attachments/20091102/491ab5ac/attachment-0001.htm>
More information about the Tweener
mailing list