home *** CD-ROM | disk | FTP | other *** search
- /*
- * $Id: overkill_test.java,v 1.8 1996/10/03 19:46:51 hudson Exp $
- * $Author: hudson $
- */
-
- package sub_arctic.test;
-
- import sub_arctic.constraints.std_function;
- import sub_arctic.lib.interactor_applet;
- import sub_arctic.lib.base_parent_interactor;
- import sub_arctic.lib.debug_interactor_applet;
- import sub_arctic.lib.manager;
- import sub_arctic.lib.interactor;
- import sub_arctic.lib.interactor_consts;
- import sub_arctic.lib.top_level;
- import sub_arctic.lib.icon;
- import sub_arctic.lib.line_display;
- import sub_arctic.lib.shadow_drag_container;
- import sub_arctic.lib.anim_mover_container;
- import sub_arctic.lib.button;
- import sub_arctic.anim.anticipation_line;
- import sub_arctic.anim.line_trajectory;
- import sub_arctic.anim.trajectory;
- import sub_arctic.anim.slow_in_slow_out;
- import sub_arctic.anim.transition;
- import sub_arctic.anim.time_interval;
- import sub_arctic.input.callback_object;
- import sub_arctic.input.event;
-
- public class overkill_test extends debug_interactor_applet
- implements interactor_consts, callback_object {
-
- protected anim_mover_container mover;
-
- public void build_ui(base_parent_interactor top)
- {
- interactor child;
- shadow_drag_container drag;
- slow_in_slow_out pace;
- trajectory path;
- transition trans;
- long now;
- time_interval interv;
-
- /* create a shadow drag container to put everything in */
- drag = new shadow_drag_container(0,0);
- // drag.set_expensive_draw(true);
- top.add_child(drag);
-
- /* add an icon */
- try {
- child = new icon(10,10,manager.load_doc_image(this,"images/gvu.gif"));
- drag.add_child(child);
-
- /* add an icon inside a sprite container */
- child = new icon(75,25,manager.load_doc_image(this,"images/gvu.gif"));
- mover = new anim_mover_container(75,25, child, this);
- drag.add_child(mover);
- } catch (java.net.MalformedURLException e) {
- System.out.println("unable to load the GVU logo!");
- return;
- }
- /* schedule the initial transition for the container */
- if (animation_on) schedule_anim();
-
- /* put in two lines */
- child = new line_display(170,10, 370,95, 2);
- drag.add_child(child);
- child = new line_display(170,95, 370,10, 2);
- drag.add_child(child);
-
- /* and a coord_tracker */
- child = new coord_tracker(10,100, "Shadow drag any interactors! [","]");
- drag.add_child(child);
-
- /* put a button in to control the animation */
- child = new button(drag.w()+10,0,"Start/Stop Animation", this);
- top.add_child(child);
- }
-
- /* transition counter so we know direction */
- protected int count = 1;
-
- protected boolean animation_on = false;
-
- /* schedule an animation transition */
- protected void schedule_anim()
- {
- slow_in_slow_out pace;
- trajectory path;
- transition trans;
- long now;
- time_interval interv;
-
- count++;
- now = time_interval.now();
- pace = new slow_in_slow_out(0.35, 0.2);
- if (count % 2 == 0)
- path = new anticipation_line(75,25, 300, 24, pace);
- else
- path = new anticipation_line(300,26, 75,25, pace);
- interv = new time_interval(now+500,now+3500);
- trans = new transition(mover, interv, path);
- mover.set_transition(trans);
- }
-
- /* callback from animation ... */
- public void callback(
- interactor from_obj,
- event evt,
- int callback_num,
- Object info)
- {
-
- /* when we get the callback for the end of the transition, schedule
- * a new one */
- if (from_obj instanceof anim_mover_container &&
- callback_num == anim_mover_container.END_TRANSITION_CALLBACK)
- {
- if (animation_on) schedule_anim();
- }
- else if (from_obj instanceof button)
- {
- animation_on = !animation_on;
- if (animation_on) schedule_anim();
- }
- }
- }
-
- /*=========================== 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/
-
- ========================================================================*/
-