//--------------------------
// example 19
// animation on/off/invert



color(red)
cube(3) DEF CUBE1

color(yellow)
cube(3) DEF CUBE2

//-----------------------------
// red cube translation
// 5,0,0  -->  5,5,0 --> 5,0,0

animation(AN1)
 key(  0%, 5, 0, 0)
 key( 50%, 5, 5, 0)
 key(100%, 5, 0, 0)
animation.translate(CUBE1,AN1) 

//-----------------------------
// yellowcube translation
// -5,0,-5  -->  -5,0,5 --> -5,0,-5

animation(AN2)
 key(  0%, -5, 0, -5)
 key( 50%, -5, 0, 5)
 key(100%, -5, 0, -5)
animation.translate(CUBE2,AN2) 



//-----------------------------
// red cube rotation
// y axis, time:  1 sec

animation(AN3,1)
 key(  0%, 0, 0, 0)
 key( 50%, 0, 180, 0)
 key(100%, 0, 360, 0)
animation.rotation(CUBE1,AN3) 


//-----------------------------
// yellow cube scale
// 

animation(AN4,3)
 key(  0%, 1, 1, 1)
 key( 50%, 1, 0.2, 1)
 key(100%, 1, 1, 1)
animation.scale(CUBE2,AN4) 


on(ANIM ON,AN1)
off(ANIM OFF,AN1)
invert(INVERT,AN2)