#include "colors.inc" declare f = 1; // There are 8 frames in this movie. #declare body_radius = 0.3; // How fat is the worm #declare leg_radius = 0.05; // How fat are the legs #declare leg_length = 0.5; // How long are the legs #declare step_size = 2; // How far does the worm move in the whole sequence #if (f = 1) // Crunched up #declare arch_height = 2.2; // Height of the central bulge #declare head_height = 0.5; // How far off the ground is the head #declare head_pos = -1; // The back of the head is where on the X axis #declare tail_height = 0.5; // How far off the ground is the tail #declare tail_pos = 0.5; // The front of the tail is where on the x axis #declare mouth_inset = 1.4; // How deep is the mouth #end #if (f = 2) // Starting to move head forwards #declare arch_height = 2.0; // Height of the central bulge #declare head_height = 0.7; // How far off the ground is the head #declare head_pos = -1-(step_size*0.2); // The back of the head is where on the X axis #declare tail_height = 0.5; // How far off the ground is the tail #declare tail_pos = 0.5; // The front of the tail is where on the x axis #declare mouth_inset = 1.36; // How deep is the mouth #end #if (f = 3) // Moving head forwards #declare arch_height = 1.583; // Height of the central bulge #declare head_height = 0.8; // How far off the ground is the head #declare head_pos = -1-(step_size*0.5);// The back of the head is where on the X axis #declare tail_height = 0.5; // How far off the ground is the tail #declare tail_pos = 0.5; // The front of the tail is where on the x axis #declare mouth_inset = 1.3; // How deep is the mouth #end #if (f = 4) // Finishing moving head forwards #declare arch_height = 1.167; // Height of the central bulge #declare head_height = 0.7; // How far off the ground is the head #declare head_pos = -1-(step_size*0.8);// The back of the head is where on the X axis #declare tail_height = 0.5; // How far off the ground is the tail #declare tail_pos = 0.5; // The front of the tail is where on the x axis #declare mouth_inset = 1.24; // How deep is the mouth #end #if (f = 5) // Stretched out #declare arch_height = 0.75; // Height of the central bulge #declare head_height = 0.5; // How far off the ground is the head #declare head_pos = -1-step_size; // The back of the head is where on the X axis #declare tail_height = 0.5; // How far off the ground is the tail #declare tail_pos = 0.5; // The front of the tail is where on the x axis #declare mouth_inset = 1.2; // How deep is the mouth #end #if (f = 6) // Starting to move tail forwards #declare arch_height = 1.167; // Height of the central bulge #declare head_height = 0.5; // How far off the ground is the head #declare head_pos = -1-step_size;// The back of the head is where on the X axis #declare tail_height = 0.7; // How far off the ground is the tail #declare tail_pos = 0.5-(step_size*0.2);// The front of the tail is where on the x axis #declare mouth_inset = 1.24; // How deep is the mouth #end #if (f = 7) // Moving tail forwards #declare arch_height = 1.583; // Height of the central bulge #declare head_height = 0.5; // How far off the ground is the head #declare head_pos = -1-step_size;// The back of the head is where on the X axis #declare tail_height = 0.8; // How far off the ground is the tail #declare tail_pos = 0.5-(step_size*0.5);// The front of the tail is where on the x axis #declare mouth_inset = 1.3; // How deep is the mouth #end #if (f = 8) // Finishing move tail forwards #declare arch_height = 2.0; // Height of the central bulge #declare head_height = 0.5; // How far off the ground is the head #declare head_pos = -1-step_size;// The back of the head is where on the X axis #declare tail_height = 0.7; // How far off the ground is the tail #declare tail_pos = 0.5-(step_size*0.8);// The front of the tail is where on the x axis #declare mouth_inset = 1.36; // How deep is the mouth #end #declare camera_light_pos = -step_size * f/8; // X offset to slide the camera and lights #macro legs(pos, height) // Return a pair of leg cylinders union { cylinder { , , leg_radius } cylinder { , , leg_radius } } #end camera { location <-4+camera_light_pos, 1.5, -3> look_at <-1.5+camera_light_pos, 1, 0> } // Two lights, one on either side of the camera. light_source { <10+camera_light_pos, 10, -10> color White } light_source { <-10+camera_light_pos, 20, 10> color White } fog { color LightBlue distance 100 } plane {y, 0 pigment { checker color DarkBrown, color DarkTan scale step_size/2 } } #declare arch_pos = (head_pos+tail_pos) / 2; difference { union { sphere_sweep { linear_spline 2, , body_radius , body_radius } sphere_sweep { cubic_spline 4, , body_radius , body_radius , body_radius , body_radius tolerance 0.01 } sphere_sweep { cubic_spline 4, , body_radius , body_radius , body_radius , body_radius tolerance 0.01 } sphere_sweep { linear_spline 2, , body_radius , body_radius } // Front legs legs(head_pos, head_height) legs(head_pos-0.5, head_height) legs(head_pos-1, head_height) // Back legs legs(tail_pos, tail_height) legs(tail_pos+0.5, tail_height) legs(tail_pos+1, tail_height) pigment { color Green } } prism { // Mouth linear_sweep linear_spline -1, // sweep the following shape from here ... 1, // ... up through here 4, // the number of points making up the shape ... <0,0>, <-.5,-.1>, <-.5,.1>, <0, 0> rotate <90, 0, 0> translate pigment { color Red } } } sphere { // Right eye , body_radius/3 finish {phong 1 phong_size 100} pigment { color Black } } sphere { // Left eye , body_radius/3 finish {phong 1 phong_size 100} pigment { color Black } }