import java.util.Enumeration; import javax.media.j3d.*; import javax.vecmath.*; // User-defined frame moving behavior class public class FrameBehavior extends Behavior { Alpha alpha; Curve3f fun; float scale; TransformGroup tg; //Morph morph; //double weights[]; WakeupOnElapsedFrames w = new WakeupOnElapsedFrames(0); // Override Behavior's initialize method to setup wakeup criteria public void initialize() { alpha.setStartTime(System.currentTimeMillis()); // Establish initial wakeup criteria wakeupOn(w); } // Override Behavior's stimulus method to handle the event public void processStimulus(Enumeration criteria) { float val = (float) (scale* alpha.value()); //System.out.println ( "Value is " + val ); tg.setTransform( fun.frameAt ( val ) ); // Set wakeup criteria for next time wakeupOn(w); } public FrameBehavior(Alpha a, Curve3f h, float s, TransformGroup tgp ) { alpha = a; fun = h; scale = s; tg = tgp; } }