You could probably approximate the yepp curve by just using the top half
of the parabola, right?
Helen Triolo wrote:
Eric,
Using the function for a parabola is the easiest way I can think of to
let you drag a clip in an arc (but it's not quite the same as the yepp
example -- you'd need to have the equation for that curve or figure
out how to do it with a bezier for that kind of motion). Here is some
code which will make a square and a parabola and drag the square along
that curve and change its scale and alpha according to where it is
(paste into empty movie to see):
// parabola equation for curve facing left: y**2 = -4ax
function parabola_x(a:Number, y:Number) {
return( 0 - (y * y / (4 * a)) );
}
this.createEmptyMovieClip("s", 2);
s.beginFill(0,100);
s.moveTo(-20,-20);
s.lineTo(20,-20);
s.lineTo(20,20);
s.lineTo(-20,20);
s.endFill();
// vary a to change the shape of the parabola
var a:Number = 50;
this.createEmptyMovieClip("curve", 1);
curve.lineStyle(2, 0x666666, 100);
curve.moveTo(200+parabola_x(a, -100), -100);
for (var y=(-90); y<100; y+=10) {
curve.lineTo(200+parabola_x(a, y), y);
}
curve._y += 200;
s._x = 200+parabola_x(a, 0);
s._y = 200;
s.onPress = function() {
this.startDrag();
this.onMouseMove = function() {
this._x = 200 + parabola_x(a, 200-this._y);
this._xscale = this._yscale = this._alpha = 140 - Math.abs(200
- this._y);
}
}
s.onRelease = s.onReleaseOutside = function() {
delete this.onMouseMove;
this.stopDrag();
}
_______________________________________________
Flashcoders@chattyfig.figleaf.com
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