Thats very cool too - but I would like to dynamically affect the position
of
a MC, not using a tween engine where i tell it go from here to there. I
just
wanna be able to tell a mc to be:
a scale
an alpha
at this x, y
and when I move my mouse up/down, affect all three of those, while moving
it
on an arc.
http://www.ericd.net/new_css/img/arc.jpg
Like that - ultimately with more than one object - using a bunch of
them...
Eric - What you're looking for then is probably Penner's pointOnCurve, as
Moses has cited. It's basically this (this is the version I use):
_global.findPointOnCurve = function (p1x, p1y, cx, cy, p2x, p2y, t) {
// Returns the points on a bezier curve for a given time (t is 0-1);
// This is based on Robert Penner's Math.pointOnCurve() function
// More information: http://actionscript-toolbox.com/samplemx_pathguide.php
return {x:p1x + t*(2*(1-t)*(cx-p1x) + t*(p2x - p1x)),
y:p1y + t*(2*(1-t)*(cy-p1y) + t*(p2y - p1y))};
};
You create a curve (like the bezier ones from curveTo) and then pass a
parameter of what point you want from it, from start to end.
However, there's two things worth mentioning:
1. Depending on the curve you're doing, this function will produce odd point
distribution. On a curve as simple as the one you mentioned, you wouldn't
have a problem. But on more acute angles, you would; on this case,
dembicki.org's functions would be better. Ivan (I think that was his name?
sorry) himself has posted on this list a long time ago talking about this
issue and he had examples to show what he meant.
2. If you're just trying to mimic the way OSX's dock works, you don't need
that. You would just have to determine the movieclip scale according to the
mouse position or whatever it is your controller, and then distribute other
movieclips around it, and maybe moving it a bit to the right according to
the mouse distance/scale too. It's a change that is done only to the scale,
not along a curve, but that ultimately gives you this effect.. kinda like
the old Tsunami effect, but slightly less annoying. If you want to properly
align everything on a curve, you will have to do a lot of calculations to
properly distribute elements while still keeping the right distance between
each other. But really, *IF* you're just trying to emulate the dock, you
don't need it.
- zeh
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com