curvethru.as
来自「这是《Flash MX编程与创意实现》的源代码」· AS 代码 · 共 32 行
AS
32 行
/*
CurveThru v1.1
Oct. 29, 2002
(c) 2002 Robert Penner
MovieClip methods to draw a quadratic bezier (three control points)
through a given point..
Dependencies: _xpen and _ypen movie clip properties (drawing_api_core_extensions.as)
The _xpen and _ypen properties are discussed in Chapter 10 of
Robert Penner's Programming Macromedia Flash MX
http://www.robertpenner.com/profmx
http://www.amazon.com/exec/obidos/ASIN/0072223561/robertpennerc-20
*/
MovieClip.prototype.drawCurve3Pts = function (x1, y1, x2, y2, x3, y3) {
var cx = 2*x2 - .5*(x1 + x3);
var cy = 2*y2 - .5*(y1 + y3);
this.moveTo (x1, y1);
this.curveTo (cx, cy, x3, y3);
};
MovieClip.prototype.curveToThru = function (px, py, ax, ay) {
var cx = 2*px - .5*(this._xpen + ax);
var cy = 2*py - .5*(this._ypen + ay);
this.curveTo (cx, cy, ax, ay);
};
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?