home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #7 / amigamamagazinepolishissue1998.iso / varia / povray3 / povray3_060 / pov3demo / anim / slinky / slnk.pov < prev   
Text File  |  1997-12-12  |  3KB  |  99 lines

  1. // Slinky.pov
  2. // Three sets of perpendicular rings whose count and position varies
  3. // as it breathes in and out
  4. // 01/10/95 - Jeff Bowermaster
  5.  
  6. #declare d = 3.45+1*sin(2*pi*clock)
  7. #declare d_angle=pow(2,d)
  8.  
  9. #include "colors.inc"
  10. #include "textures.inc"
  11.  
  12. camera {
  13.   location <4, 4, 4>
  14.   right <4/3, 0, 0>
  15.   up <0, 1, 0>
  16.   direction <-1,-1,-1>
  17.   look_at <0, 0.25, 0>
  18. }
  19.  
  20. background { color rgb <0.078,0.361,0.753>*0.5 }
  21.  
  22. #declare dim = 0.5
  23.  
  24. light_source { <  5,  0, 0 > color rgb <0.25,0.5,0.75> }
  25. light_source { <  0,  5, 0 > color rgb <1,0.1,0.1> }
  26. light_source { <  0,  0, 5 > color rgb <1,0.8,0.1> }
  27.  
  28. light_source { <  0,  0, 0 > color rgb <1,1,1>*dim }
  29.  
  30. #declare rad = pi/180
  31.  
  32. #declare white_plastic = 
  33. texture {
  34.     pigment { color rgb <1, 1, 1> }
  35.     finish {ambient 0.1 diffuse 0.8 phong 0.5 phong_size 100 }
  36. }
  37.  
  38. #declare thick = 0.025     // thickness of the rings
  39. #declare smidge = 0.0001   // slight excess to bore out the cylinders
  40. #declare ang=d_angle       // parameter that determines the number of rings
  41.                            // it's the number of degrees between each ring
  42.  
  43. #declare f = 0.2           // scalar for in/out motion
  44. #declare w = 1.0           // sets the width of the effect
  45.  
  46. // although each axis could move at different times, they don't
  47.  
  48. #declare cx = 0.50         // center of maximum displacement
  49. #declare cy = 0.50
  50. #declare cz = 0.50
  51.  
  52. #while (ang < 90)
  53.  
  54.    #declare r = sin(ang * rad)
  55.    #declare c = cos(ang * rad)
  56.  
  57.    #declare fx = f/exp(((clock - cx)/w)*((clock - cx)/w))/r
  58.    #declare fy = f/exp(((clock - cy)/w)*((clock - cy)/w))/r
  59.    #declare fz = f/exp(((clock - cz)/w)*((clock - cz)/w))/r
  60.  
  61.    difference {
  62.       object { cylinder { <0,0,-c-fz-thick>,<0,0,-c-fz+thick>,r }}
  63.       object { cylinder { <0,0,-c-fz-thick-fz-smidge>,<0,0,-c-fz+thick+smidge>,r-thick*2 }}
  64.       texture { white_plastic }
  65.    }
  66.    difference {
  67.       object { cylinder { <0,0, c+fz-thick>,<0,0, c+fz+thick>,r }}
  68.       object { cylinder { <0,0, c+fz-thick-smidge>,<0,0, c+fz+thick+smidge>,r-thick*2 }}
  69.       texture { white_plastic }
  70.    }
  71.    difference {
  72.       object { cylinder { <0,-c-fy-thick,0>,<0,-c-fy+thick,0>,r }}
  73.       object { cylinder { <0,-c-fy-thick-smidge,0>,<0,-c-fy+thick+smidge,0>,r-thick*2 }}
  74.       texture { white_plastic }
  75.    }
  76.    difference {
  77.       object { cylinder { <0, c+fy-thick,0>,<0, c+fy+thick,0>,r }}
  78.       object { cylinder { <0, c+fy-thick-smidge,0>,<0, c+fy+thick+smidge,0>,r-thick*2 }}
  79.       texture { white_plastic }
  80.    }
  81.    difference {
  82.       object { cylinder { <-c-fx-thick,0,0>,<-c-fx+thick,0,0>,r }}
  83.       object { cylinder { <-c-fx-thick-smidge,0,0>,<-c-fx+thick+smidge,0,0>,r-thick*2 }}
  84.       texture { white_plastic }
  85.    }
  86.    difference {
  87.       object { cylinder { < c+fx-thick,0,0>,< c+fx+thick,0,0>,r }}
  88.       object { cylinder { < c+fx-thick-smidge,0,0>,< c+fx+thick+smidge,0,0>,r-thick*2 }}
  89.       texture { white_plastic }
  90.    }
  91.   #declare ang=ang+d_angle
  92.  
  93. #end
  94.  
  95.  
  96. disc { <0,0,0>, <0,0,1>,10 texture { white_plastic } translate <0,0,-3> }
  97. disc { <0,0,0>, <0,1,0>,10 texture { white_plastic } translate <0,-3,0> }
  98. disc { <0,0,0>, <1,0,0>,10 texture { white_plastic } translate <-3,0,0> }
  99.