import java.awt.*; import render.*; public class test1 extends RenderApplet { Geometry myBox, myBall; Material red; double amplitude = 0; public void initialize() { setBgColor(.4,.4,.8); addLight(1,1,1, 1,1,1); red = new Material(); red.setAmbient(.2,.0,.1); red.setDiffuse(.8,.0,.0); red.setSpecular(1,1,1,20); myBox = world.add().globe(40,20).superquadric(8,0).setMaterial(red); myBall = world.add().globe(16,8).setMaterial(red); } public boolean keyUp(Event e, int key) { if (key == ' ') { amplitude = .3; return true; } else return super.keyUp(e, key); } // FORWARD KINEMATICS public void animate(double time) { double boing1 = amplitude * Math.sin(20 * time); double boing2 = amplitude * Math.sin(25 * time); double boing3 = amplitude * Math.sin(30 * time); push(); shear(boing1, 0, 1); shear(boing2, 1, 2); shear(boing3, 2, 0); transform(myBox); translate(0,2,0); transform(myBall); pop(); amplitude *= .9; } }