POV-Ray : Newsgroups : povray.binaries.animations : Multi-Stage Animation Macro test : Multi-Stage Animation Macro test Server Time
2 May 2024 05:03:01 EDT (-0400)
  Multi-Stage Animation Macro test  
From: Anthony D  Baye
Date: 12 Mar 2013 14:35:00
Message: <web.513f74977b158278d97ee2b90@news.povray.org>
A simple animation to test my multi-stage animation macros.

Scene file: Three rotating segmented rings.  Four separate timelines, each with
three stages.

I've made a note of the command-line for encoding the 600-frame animation in
mencoder, but you'll need to remove the back-slashes.

If you like my method, I can upload the macros.

Regards,
A.D.B.

/*
 Persistence of Vision Ray-Tracer Scene Description File
 Name: Rings.pov
 Vers: 3.6
 Desc:
 Date: 01-30-08
 Auth: Anthony D. Baye
 Note: mencoder mf:\/\/\*.png -mf w=1024:h=768:fps=30:type=png -ovc x264
-x264encopts preset=slow:tune=film:crf=20 -of avi -o Rings.avi
*/

#include "kolors.inc"
#include "metals.inc"
#include "glass.inc"
#include "anim.inc"

/* !--- Global Settings ---! */
#declare ANI = clock_on;
/* !-----------------------! */
#default { pigment { Orange } finish { ambient 0.3 diffuse 0.6 } }

light_source { <0.0, 30.0 -15.0> color rgb 1 media_interaction off }
camera {
 location <3.0, 5.0, -10.0>
 look_at 0.0
 }


#declare colors =
array [7] {
 Red,
 Orange,
 Yellow,
 Green,
 Blue,
 Indigo,
 Violet
 }

#macro Ring(Rad, segCount, Tilt, Phase)

#local rSpan = 360/segCount;
#declare ringSeg =
difference {
 merge {
  cylinder { <0.0, 0.0, -0.3125> <0.0, 0.0, 0.3125> Rad }
  cylinder { <0.0, 0.0, -0.25> <0.0, 0.0, 0.25> Rad+0.03125 }
  }
 cylinder { <0.0, 0.0, -0.34375> <0.0, 0.0, 0.34375> Rad-0.1875 }
 cylinder { <0.0, 0.0, -0.25> <0.0, 0.0, 0.25> Rad-0.125 }
 box { <0.0, -(Rad+0.0625), -0.34375> <(Rad+0.0625), (Rad+0.0625), 0.34375>
  rotate -(rSpan/2)*z }
 box { <0.0, -(Rad+0.0625), -0.34375> <-(Rad+0.0625), (Rad+0.0625), 0.34375>
  rotate (rSpan/2)*z }
 union {
  difference {
   cylinder { <0.0, 0.0, -0.34375> <0.0, 0.0, 0.34375> 0.1875 }
   cylinder { <0.0, 0.0, -0.31251> <0.0, 0.0, 0.31251> 0.09375 }
   box { <0.0, -0.21875, -0.375> <-0.21875, 0.21875, 0.375> }
   }
  cylinder { -0.25*z, -0.34375*z  0.109375 }
  cylinder { 0.25*z, 0.34375*z  0.109375 }
  cylinder { -0.28125*z, 0.28125*z  0.046875 }
   translate -0.09375*x
   rotate -(rSpan/2)*z
   translate <(Rad-0.09375)*sin(radians((rSpan/2))),
    (Rad-0.09375)*cos(radians((rSpan/2))), 0.0>
  }
 union {
  difference {
   cylinder { <0.0, 0.0, -0.34375> <0.0, 0.0, 0.34375> 0.1875 }
   cylinder { <0.0, 0.0, -0.31251> <0.0, 0.0, 0.31251> 0.09375 }
   box { <0.0, -0.21875, -0.375> <0.21875, 0.21875, 0.375> }
   }
  cylinder { -0.25*z, -0.34375*z  0.109375 }
  cylinder { 0.25*z, 0.34375*z  0.109375 }
  cylinder { -0.28125*z, 0.28125*z  0.046875 }
   translate 0.09375*x
   rotate (rSpan/2)*z
   translate <-(Rad-0.09375)*sin(radians((rSpan/2))),
    (Rad-0.09375)*cos(radians((rSpan/2))), 0.0>
  }
  pigment { White }
//  finish { F_MetalC }
  finish {
   ambient 0.3
   diffuse 0.6
 //  roughness 0.01
 //  specular 0.5
   }
  rotate 90.0*x
 }

union {
#local a = 0;
#local cIndex = 0;
#while(a < 360)

#if(cIndex > 6)
 #local cIndex = 0;
#end

 object { ringSeg rotate (a + Phase)*y
  rotate Tilt pigment { colors[cIndex] } }

#local cIndex = cIndex + 1 ;

#local a = a + (360 / segCount);
#end
 }

#end

#local C = 18;
#local O = 180/C;
#local S = degrees(15)*clock;
#local D = (2*pi*3) / C;

#if(ANI)
     initAnimation(<0,0,20>)
#end

union {
     Ring(3.0, 18, 120.0*z, (Timer(1, <0,0,0>, <0,0,5>,
300)+Timer(4,<0,0,5>,<0,0,20>,4500)+Timer(1, <0,0,15>, <0,0,20>, -300)))
     Ring(3.5, 18, 60.0*z, (Timer(1, <0,0,1>, <0,0,6>,
300)+Timer(4,<0,0,6>,<0,0,19>,4500)+Timer(1, <0,0,14>, <0,0,19>, -300)))
          rotate (Timer(1, <0,0,4>, <0,0,7>,
150)+Timer(4,<0,0,7>,<0,0,16>,1200)+Timer(1, <0,0,13>, <0,0,16>, -150))*y
     }
Ring(4.0, 12, 0.0, (Timer(1, <0,0,2>, <0,0,7>,
300)+Timer(4,<0,0,7>,<0,0,18>,4500)+Timer(1, <0,0,13>, <0,0,18>, -300)))


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.