import graphics3d.Graphics3DFramework; import Graphics3D; import Math; // For using the sin() function // Variables to store model IDs int axis, sphere; // Time counter (in units of frame updates) int t = 0; // Function called at the start of the program void onStart ( int rendererID ) { // Optional settings: window size and background color setWindowSize( 800, 600 ); setBackgroundColor( 0, 0, 0, 255 ); // Create and place coordinate axes axis = newAxisModel( 3.0, 3.0, 3.0 ); mountModel( axis, rendererID ); // Create and place a sphere model sphere = newSphereModel( 2.0, 2.0, 2.0, 10, 8 ); mountModel( sphere, rendererID ); } // Function called repeatedly at each frame update (several times per second) void onUpdate (int rendererID) { // Animate the sphere by deforming it and updating the time counter setModelSize( sphere, 1.0 + sin( 0.1 * t ) , 2.0, 2.0 ); t++; }