/* A simple applet to demonstrate java controlled VRML animations. Author: Kimbro Staken Date: Sept. 19, 1996 */ import java.applet.Applet; import java.lang.Thread; import vrml.external.Browser; import vrml.external.Node; import vrml.external.field.*; import netscape.plugin.Plugin; import netscape.javascript.JSObject; public class LogoAnim extends Applet { Browser browse; public void init() { //Get the Javascript object for the window where our applet resides. JSObject win = JSObject.getWindow(this); //Use the Javascript object to get a reference to the VRML plugin interface. browse = (Browser)win.eval("document.embeds[0]"); Node mover = browse.getNode("logo"); EventInSFVec3f translation = (EventInSFVec3f)mover.getEventIn("set_translation"); float value[] = new float[3]; try { for (int j = -40; j < 7; j++) { Thread.sleep(100); value[0] = 0; value[1] = 0; value[2] = j; translation.setValue(value); } Thread.sleep(3000); for (int j = 6; j > -40; j--) { Thread.sleep(100); value[0] = 0; value[1] = 0; value[2] = j; translation.setValue(value); } } catch (Exception e) { } } }