diff --git a/src/as/com/threerings/flash/path/CompositePath.as b/src/as/com/threerings/flash/path/CompositePath.as deleted file mode 100644 index 8b3cc401..00000000 --- a/src/as/com/threerings/flash/path/CompositePath.as +++ /dev/null @@ -1,59 +0,0 @@ -// -// $Id$ -// -// Nenya library - tools for developing networked games -// Copyright (C) 2002-2007 Three Rings Design, Inc., All Rights Reserved -// http://www.threerings.net/code/nenya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.flash.path { - -import flash.display.Sprite; - -import com.threerings.util.Util; - -/** - * Executes a series of paths in order. - */ -[Deprecated(replacement="caurina.transitions.Tweener")] -public class CompositePath extends Path -{ - /** - * Creates a composite path with the supplied list of individual paths. - */ - public function CompositePath (... paths) - { - _paths = Util.unfuckVarargs(paths); - init(new Sprite()); // any old display object will do (yay actionscript) - } - - // from Path - override protected function tick (curStamp :int) :int - { - var remain :int = 0; - if (_pathIdx >= 0) { - remain = tickPath(_paths[_pathIdx] as Path, curStamp); - } - while (remain <= 0 && ++_pathIdx < _paths.length) { - remain = startPath(_paths[_pathIdx] as Path, curStamp, remain); - } - return remain; - } - - protected var _paths :Array; - protected var _pathIdx :int = -1; -} -} diff --git a/src/as/com/threerings/flash/path/DelayPath.as b/src/as/com/threerings/flash/path/DelayPath.as deleted file mode 100644 index 91137810..00000000 --- a/src/as/com/threerings/flash/path/DelayPath.as +++ /dev/null @@ -1,43 +0,0 @@ -// -// $Id$ -// -// Nenya library - tools for developing networked games -// Copyright (C) 2002-2007 Three Rings Design, Inc., All Rights Reserved -// http://www.threerings.net/code/nenya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.flash.path { - -/** - * Doesn't actually move anything, but simply delays in the current position for some period of - * time. This is generally used with a {@link CompositePath}. - */ -[Deprecated(replacement="caurina.transitions.Tweener")] -public class DelayPath extends Path -{ - public function DelayPath (delay :int) - { - _delay = delay; - } - - override protected function tick (curStamp :int) :int - { - return _delay - (curStamp - _startStamp); - } - - protected var _delay :int; -} -} diff --git a/src/as/com/threerings/flash/path/EasingPath.as b/src/as/com/threerings/flash/path/EasingPath.as deleted file mode 100644 index c19fb4e7..00000000 --- a/src/as/com/threerings/flash/path/EasingPath.as +++ /dev/null @@ -1,71 +0,0 @@ -// -// $Id: LinePath.as 359 2007-12-03 21:08:33Z dhoover $ - -package com.threerings.flash.path { - -import flash.display.DisplayObject; - -/** - * Adapts mx.effects.easing or Tweener functions for use as a Path. - */ -[Deprecated(replacement="caurina.transitions.Tweener")] -public class EasingPath extends Path -{ - /** - * @param destX the destination x coordinate - * @param destY the destination y coordinate - * @param duration the duration of the path, in milliseconds. - * @param xfunc a Function to provide x coordinates. Signature: - * function (t :Number, b :Number, c :Number, d :Number) :Number - * t = elapsed time - * b = initial position - * c = total change in position - * d = duration - * @param yfunc a Function to provide y coordinates. If omitted, the xfunc is used. - * @param startX the starting x coordinate. If omitted, the DisplayObject's current coordinate - * is used. - * @param startY the starting y coordinate. If omitted, the DisplayObject's current coordinate - * is used. - */ - public function EasingPath ( - target :DisplayObject, destX :Number, destY :Number, duration :int, - xfunc :Function, yfunc :Function = null, startX :Number = NaN, startY :Number = NaN) - { - if (isNaN(startX)) { - startX = target.x; - } - if (isNaN(startY)) { - startY = target.y; - } - if (yfunc == null) { - yfunc = xfunc; - } - _duration = duration; - _startX = startX; - _startY = startY; - _deltaX = destX - startX; - _deltaY = destY - startY; - _xfunc = xfunc; - _yfunc = yfunc; - init(target); - } - - override protected function tick (curStamp :int) :int - { - var t :Number = curStamp - _startStamp; - _target.x = _xfunc(t, _startX, _deltaX, _duration); - _target.y = _yfunc(t, _startY, _deltaY, _duration); - - // return the number of milliseconds before we're done - return _duration - t; - } - - protected var _xfunc :Function; - protected var _yfunc :Function; - protected var _startX :Number; - protected var _startY :Number; - protected var _deltaX :Number; - protected var _deltaY :Number; - protected var _duration :int; -} -} diff --git a/src/as/com/threerings/flash/path/HermiteFunc.as b/src/as/com/threerings/flash/path/HermiteFunc.as deleted file mode 100644 index 6a178edd..00000000 --- a/src/as/com/threerings/flash/path/HermiteFunc.as +++ /dev/null @@ -1,82 +0,0 @@ -// -// $Id$ -// -// Nenya library - tools for developing networked games -// Copyright (C) 2002-2007 Three Rings Design, Inc., All Rights Reserved -// http://www.threerings.net/code/nenya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.flash.path { - -/** - * Interpolates cubically between two values, with beginning and end derivates set - * to zero. See http://en.wikipedia.org/wiki/Cubic_Hermite_spline for details. - */ -[Deprecated(replacement="caurina.transitions.Tweener")] -public class HermiteFunc extends InterpFunc -{ - public function HermiteFunc (start :int, end :int, startSlope :Number = 0, endSlope :Number = 0) - { - _p0 = start; - _p1 = end; - _m0 = startSlope; - _m1 = endSlope; - } - - // from InterpFunc - override public function getValue (t :Number) :Number - { - if (t >= 1) { - return _p1; - } else if (t < 0) { // cope with a funny startOffset - return _p0; - } else { - var tt :Number = t*t; - var ttt :Number = tt * t; - - return _p0 * (2*ttt - 3*tt + 1) + - _m0 * (ttt - 2*tt + t) + - _p1 * (-2*ttt + 3*tt) + - _m1 * (ttt - tt); - } - } - - /** Get the derivative of this function at a point. */ - public function getSlope (t :Number) :Number - { - if (t >= 1 || t < 0) { // cope with a funny startOffset - return 0; - } - var tt :Number = t*t; - - return (_p0 - _p1) * (6*tt - 6*t) + - _m0 * (3*tt - 4*t + 1) + - _m1 * (3*tt - 2*t); - } - - /** The coefficient for the spline that interpolates the beginning point value. */ - protected var _p0 :Number; - - /** The coefficient for the spline that interpolates the end point value. */ - protected var _p1 :Number; - - /** The coefficient for the spline that interpolates the beginning point derivate. */ - protected var _m0 :Number; - - /** The coefficient for the spline that interpolates the end point derivate. */ - protected var _m1 :Number; -} -} diff --git a/src/as/com/threerings/flash/path/InterpFunc.as b/src/as/com/threerings/flash/path/InterpFunc.as deleted file mode 100644 index 7b3d903f..00000000 --- a/src/as/com/threerings/flash/path/InterpFunc.as +++ /dev/null @@ -1,35 +0,0 @@ -// -// $Id$ -// -// Nenya library - tools for developing networked games -// Copyright (C) 2002-2007 Three Rings Design, Inc., All Rights Reserved -// http://www.threerings.net/code/nenya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.flash.path { - -/** - * Used by paths to interpolate between two values. - */ -[Deprecated(replacement="caurina.transitions.Tweener")] -public /*abstract*/ class InterpFunc -{ - public /*abstract*/ function getValue (complete :Number) :Number - { - throw new Error("abstract"); - } -} -} diff --git a/src/as/com/threerings/flash/path/LinePath.as b/src/as/com/threerings/flash/path/LinePath.as deleted file mode 100644 index 841f208b..00000000 --- a/src/as/com/threerings/flash/path/LinePath.as +++ /dev/null @@ -1,37 +0,0 @@ -// -// $Id$ - -package com.threerings.flash.path { - -import flash.display.DisplayObject; - -/** - * Moves a display object along a line path in a specified amount of time. - */ -[Deprecated(replacement="caurina.transitions.Tweener")] -public class LinePath extends Path -{ - public function LinePath (target :DisplayObject, xfunc :InterpFunc, yfunc :InterpFunc, - duration :int) - { - _xfunc = xfunc; - _yfunc = yfunc; - _duration = duration; - init(target); - } - - override protected function tick (curStamp :int) :int - { - var complete :Number = (curStamp - _startStamp) / _duration; - _target.x = _xfunc.getValue(complete); - _target.y = _yfunc.getValue(complete); - - // return the number of milliseconds before we're done - return _duration - (curStamp - _startStamp); - } - - protected var _xfunc :InterpFunc; - protected var _yfunc :InterpFunc; - protected var _duration :int; -} -} diff --git a/src/as/com/threerings/flash/path/LinearFunc.as b/src/as/com/threerings/flash/path/LinearFunc.as deleted file mode 100644 index 07fee5d5..00000000 --- a/src/as/com/threerings/flash/path/LinearFunc.as +++ /dev/null @@ -1,51 +0,0 @@ -// -// $Id$ -// -// Nenya library - tools for developing networked games -// Copyright (C) 2002-2007 Three Rings Design, Inc., All Rights Reserved -// http://www.threerings.net/code/nenya/ -// -// This library is free software; you can redistribute it and/or modify it -// under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -package com.threerings.flash.path { - -/** - * Interpolates linearly between two values. - */ -[Deprecated(replacement="caurina.transitions.Tweener")] -public class LinearFunc extends InterpFunc -{ - public function LinearFunc (start :int, end :int) - { - _start = start; - _end = end; - } - - // from InterpFunc - override public function getValue (complete :Number) :Number - { - if (complete >= 1) { - return _end; - } else if (complete < 0) { // cope with a funny startOffset - return _start; - } else { - return ((_end - _start) * complete) + _start; - } - } - - protected var _start :int; - protected var _end :int; -} -} diff --git a/src/as/com/threerings/flash/path/Path.as b/src/as/com/threerings/flash/path/Path.as deleted file mode 100644 index c39a1013..00000000 --- a/src/as/com/threerings/flash/path/Path.as +++ /dev/null @@ -1,202 +0,0 @@ -// -// $Id$ - -package com.threerings.flash.path { - -import flash.display.DisplayObject; -import flash.events.Event; -import flash.utils.getTimer; - -/** - * Moves a display object along a particular path in a specified amount of time. - */ -[Deprecated(replacement="caurina.transitions.Tweener")] -public /*abstract*/ class Path -{ - /** - * Moves the specified display object from the specified starting coordinates to the specified - * ending coordinates in the specified number of milliseconds. - */ - public static function move (target :DisplayObject, startx :int, starty :int, - destx :int, desty :int, duration :int) :Path - { - return new LinePath(target, new LinearFunc(startx, destx), - new LinearFunc(starty, desty), duration); - } - - /** - * Moves the specified display object from its current location to the specified ending - * coordinates in the specified number of milliseconds. NOTE: beware the fact that - * Flash does not immediately apply a display object's location update, so setting x and y and - * then calling moveTo() will not work. Use {@link #move} instead. - */ - public static function moveTo (target :DisplayObject, destx :int, desty :int, - duration :int) :Path - { - return move(target, target.x, target.y, destx, desty, duration); - } - - /** - * Creates a delay path of the desired duration. For use with CompositePath. - */ - public static function delay (delay :int) :Path - { - return new DelayPath(delay); - } - - /** - * Creates a path that executes the supplied sequence of paths one after the other. - */ - public static function connect (... paths) :Path - { - return new CompositePath(paths); - } - - /** - * Starts this path. The path will be ticked once immediately and subsequently ticked every - * frame. - * - * @param onComplete an optional function to be called when it completes (or is aborted). - * @param startOffset an optional number of milliseconds by which to adjust the time at which - * the path believes that it was started. - */ - public function start () :void - { - _target.addEventListener(Event.ENTER_FRAME, onEnterFrame); - willStart(getTimer(), 0); - } - - /** - * Configures this path's onStart function. The function should have the following signature: - * function (path :Path) :void. This should only be called before the path is - * started. - * - * @return a reference to this path, for easy chaining. - */ - public function setOnStart (onStart :Function) :Path - { - _onStart = onStart; - return this; - } - - /** - * Configures this path's onComplete function. The function should have the following - * signature: function (path :Path) :void. This should generally only be called - * shortly after construction as the function will not be called if the path is already - * completed or aborted. - * - * @return a reference to this path, for easy chaining. - */ - public function setOnComplete (onComplete :Function) :Path - { - _onComplete = onComplete; - return this; - } - - /** - * Aborts this path. Any onComplete() function will be called as if the path terminated - * normally. The callback can call {@link #wasAborted} to discover whether the path was aborted - * or terminated normally. - */ - public function abort () :void - { - pathCompleted(true); - } - - /** - * Returns the target of this path. - */ - public function get target () :DisplayObject - { - return _target; - } - - /** - * Returns true if this path was aborted, false if it completed normally. This return value is - * only valid during a call to onComplete(). - */ - public function wasAborted () :Boolean - { - return _wasAborted; - } - - /** - * Derived classes must call this method to wire this path up to its target. - */ - protected function init (target :DisplayObject) :void - { - _target = target; - } - - /** - * Called when this path is about to start, either due to a call to {@link #start} or to the - * path being started by a {@link CompositePath}. - */ - protected function willStart (now :int, startOffset :int = 0) :int - { - _startStamp = now + startOffset; - if (_onStart != null) { - _onStart(this); - } - var remain :int = tick(now); - if (remain <= 0) { - pathCompleted(false); - } - return remain; - } - - /** - * Derived classes should override this method and update their target based on the current - * timestamp. They should return a positive number, indicating the number of milliseconds they - * have remaining before they are complete, or zero if they completed perfectly on time, or a - * negative number if they completed with milliseconds to spare since their last tick. - */ - protected function tick (curStamp :int) :int - { - return 0; - } - - /** - * Called when this path is has completed or was aborted. - */ - protected function didComplete (aborted :Boolean) :void - { - _wasAborted = aborted; - if (_onComplete != null) { - _onComplete(this); - } - } - - protected function onEnterFrame (event :Event) :void - { - if (tick(getTimer()) <= 0) { - pathCompleted(false); - } - } - - protected function pathCompleted (aborted :Boolean) :void - { - _target.removeEventListener(Event.ENTER_FRAME, onEnterFrame); - didComplete(aborted); - } - - // needed by CompositePath - protected static function tickPath (path :Path, curStamp :int) :int - { - return path.tick(curStamp); - } - - // needed by CompositePath - protected static function startPath (path :Path, curStamp :int, startOffset :int) :int - { - return path.willStart(curStamp, startOffset); - } - - protected var _target :DisplayObject; - protected var _onStart :Function; - protected var _onComplete :Function; - protected var _startStamp :int = -1; - protected var _wasAborted :Boolean; -} - -}