com.threerings.media.util
Class SmoothBobblePath

java.lang.Object
  extended by com.threerings.media.util.BobblePath
      extended by com.threerings.media.util.SmoothBobblePath
All Implemented Interfaces:
Path

public class SmoothBobblePath
extends BobblePath

Bobble a Pathable smoothly.


Field Summary
protected  int _newx
          The next position.
protected  int _newy
          The next position.
protected  int _oldx
          The previous position.
protected  int _oldy
          The previous position.
 
Fields inherited from class com.threerings.media.util.BobblePath
_duration, _dx, _dy, _nextMove, _stopTime, _sx, _sy, _updateFreq
 
Constructor Summary
SmoothBobblePath(int dx, int dy, long duration)
           
SmoothBobblePath(int dx, int dy, long duration, long updateFreq)
           
 
Method Summary
 void init(Pathable pable, long tickstamp)
          Called once to let the path prepare itself for the process of animating the supplied pathable.
 boolean tick(Pathable pable, long tickStamp)
          Called to request that this path update the position of the specified pathable based on the supplied timestamp information.
 
Methods inherited from class com.threerings.media.util.BobblePath
fastForward, paint, setUpdateFrequency, setVariance, stop, updatePositionTo, wasRemoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_oldx

protected int _oldx
The previous position.


_oldy

protected int _oldy
The previous position.


_newx

protected int _newx
The next position.


_newy

protected int _newy
The next position.

Constructor Detail

SmoothBobblePath

public SmoothBobblePath(int dx,
                        int dy,
                        long duration)

SmoothBobblePath

public SmoothBobblePath(int dx,
                        int dy,
                        long duration,
                        long updateFreq)
Method Detail

init

public void init(Pathable pable,
                 long tickstamp)
Description copied from interface: Path
Called once to let the path prepare itself for the process of animating the supplied pathable. Path users should also call Path.tick(com.threerings.media.util.Pathable, long) after Path.init(com.threerings.media.util.Pathable, long) with the same initialization timestamp.

Specified by:
init in interface Path
Overrides:
init in class BobblePath

tick

public boolean tick(Pathable pable,
                    long tickStamp)
Description copied from interface: Path
Called to request that this path update the position of the specified pathable based on the supplied timestamp information. A path should record its initial timestamp and determine the progress of the pathable along the path based on the time elapsed since the pathable began down the path.

Specified by:
tick in interface Path
Overrides:
tick in class BobblePath
Parameters:
pable - the pathable whose position should be updated.
tickStamp - the timestamp associated with this frame.
Returns:
true if the pathable's position was updated, false if the path determined that the pathable should not move at this time.