puts "=================================="
puts "Viewer animation - rotate the view camera"
puts "=================================="

pload MODELING VISUALIZATION

vclear
vinit View1
vaxo
vzbufftrihedron

box b1 -50 -50 0 100 100 100
vdisplay -noupdate -dispMode 1 b1
vfit -noupdate

# Animation simulates the following rotation:
# vrotate 2 0 0
vanimation anim -clear
vanimation anim/movecam -view -at1 0 0 50 -at2 0 0 50 -eye1 100 -100 150 -eye2 -153 -70 8 -duration 3

vanimation anim -play 0.0 0.0
if {[vreadpixel 306 280 rgb name] != "DARKGOLDENROD3" || [vreadpixel 325 280 rgb name] != "DARKGOLDENROD3"} { puts "Error: Camera rotate result is wrong!" }
vdump $imagedir/${casename}_0.png

vanimation anim -play 1.0 0.0
if {[vreadpixel 306 280 rgb name] != "DARKORANGE4"    || [vreadpixel 325 280 rgb name] != "BLACK"}          { puts "Error: Camera rotate result is wrong!" }
vdump $imagedir/${casename}_1.png

vanimation anim -play 2.0 0.0
if {[vreadpixel 306 280 rgb name] != "GOLDENROD2"     || [vreadpixel 325 280 rgb name] != "GOLDENROD2"}     { puts "Error: Camera rotate result is wrong!" }
vdump $imagedir/${casename}_2.png

puts "Put the following command to start interactive animation:"
puts "    vanimation anim -play"
