Animating Fog
Fade to Black
This example uses a black fog to create a fade effect. The fog begins rolling in after 5 seconds, and takes 4 seconds to fill the scene.
environment myEnvironment (clip(.1 10000)
timer (duration(4),startValues(10000 50000),endValues(0 2),
when(changed,myEnvironment.fog(lin 0 0 0 $value0 $value1)),start+5)
Day into Night
This example animates the sky and fog from day to night. There are two timers, to go first to sunset, and then to night.
environment myEnvironment (clip(.1 1000),fog (lin 1 1 1 500 1000),
skyTopColor(.3 .5 1),skyBottomColor(.8 .9 1),horizonColor(1 1 1))
timer sunsetTimer (duration(30),
startValues(1 1 1 .3 .5 1 .8 .9 1 1 1 1),
endValues(.5 .5 .5 .8 .5 .7 1 0 0 1 0 0),
when (changed,myEnvironment.fog(lin $value0 $value1 $value2 500 1000),
myEnvironment.skyTopColor($value3 $value4 $value5),
myEnvironment.skyBottomColor($value6 $value7 $value8),
myEnvironment.horizonColor($value9 $value10 $value11)),
when(back,twilightTimer.start),
start+10)
timer twilightTimer (duration(30),
startValues(.5 .5 .5 .8 .5 .7 1 0 0 1 0 0),
endValues(0 0 0 0 0 .1 0 0 .3 .2 .2 .4),
when (changed,myEnvironment.fog(lin $value0 $value1 $value2 500 1000),
myEnvironment.skyTopColor($value3 $value4 $value5),
myEnvironment.skyBottomColor($value6 $value7 $value8),
myEnvironment.horizonColor($value9 $value10 $value11)))
(c) Ben Chang