From: "Rob Elsam" <[EMAIL PROTECTED]>
Sent: Wednesday, August 28, 2002 2:03 PM


> In my program I have a pause button that works by
> setting the interpolator's value to null:
> Interpolator.setAlpha(null);

Your Interpolator is still waking up and looking for an Alpha, and it will
generate the exception.  When you 'Pause', you have to turn off the alarm.
One way to do this is to extend the Interpolator, adding the capability to
wakeupOnBehaviorPost, and adding Listener methods for your controls -
methods that set a flag and Post an Id.  Pick apart the wakeup in
processStimulus where you save the system clock settings for the restart,
turn off the wakeupOnElapsedFrames, and be sure to turn the
WakeupOnBehaviorPost again so you can respond to the 'Continue' button.

Remember that when you do this, the system clock, the basis for your motion,
keeps running.  When you resume, your Interpolator will lurch to match the
advanced clock.  If you want to avoid the lurch, you either have to save
enough information to restart Alpha or you have to write your own clock.

I don't use the former method, but I think that to do it you can get away
with something pretty simple like assuring equvalent durations with
Alpha.getStartTime() and Alpha.set StartTime(long t).  When 'Pause' is
pressed, calculate and store the elapsed time

long et = System.CurrentTimeMillis() - myAlpha.getStartTime();

then, when the 'Continue' is pressed,

myAlpha.setStartTime(System.CurrentTimeMillis() - et);

> . . .

hth,
Fred Klingener

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to