home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-10-04 | 3.4 KB | 103 lines |
- package sub_arctic.anim;
-
- import sub_arctic.input.event;
-
- /**
- * This is a subclass of transition which just generates a "pulse" to
- * an object which an amount of time has elapsed. The object must
- * be an implementation of the interface "timer." If you wish to
- * cancel a timer before it goes off, you will need to use the
- * remove_transition() function on the animation agent.<p>
- *
- * @author Ian Smith
- */
- public class timer_transition extends transition {
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * This is the object we are going to notify.
- */
- timer _target;
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Create a timer transition which is scheduled to go off in some
- * number of milliseconds. This is a best effort system, so it may
- * be some arbitrary amount of time (but usually small) after this
- * time elapses before your timer gets notified.<p>
- *
- * @param timer t the object to be notified
- * @param long l the number of milliseconds until the notification
- */
- public timer_transition(timer t, long l) {
- super(null,null,null);
-
- long n=time_interval.now();
- _target=t;
- set_interval(new time_interval(n,n+l));
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Start a transition. This type of transition ignores this call.<p>
- *
- * @param event e the animation event that caused things to get going
- * @param Object user_info the object passed to the animation agent when
- * the animatable joined its focus set
- */
- public void start(event e,Object user_info) { }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Perform a step... This type of transition ignores this call.<p>
- *
- * @param event e the animation event for this step
- * @param Object user_info the object passed to the animation agent when
- * the animatable joined its focus set
- * @param long current_time the time it is "now" for this time step
- */
- public void step(event e, Object user_info, long current_time) {
-
- /* are we past the end or at it?*/
- if (current_time>=interval().end_time()) {
- _finished=true;
- }
-
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Send the end message to the timer that the time has expired.
- *
- * @param event e the animation event for this step
- * @param Object user_info the object passed to the animation agent when
- * the animatable joined its focus set (ignored)
- */
- public void end(event e, Object user_info) {
- _target.time_expired(e);
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
- }
- /*=========================== COPYRIGHT NOTICE ===========================
-
- This file is part of the subArctic user interface toolkit.
-
- Copyright (c) 1996 Scott Hudson and Ian Smith
- All rights reserved.
-
- The subArctic system is freely available for most uses under the terms
- and conditions described in
- http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html
- and appearing in full in the lib/interactor.java source file.
-
- The current release and additional information about this software can be
- found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
-
- ========================================================================*/
-