第1章だけの知識でできたプログラムを紹介したいと思います。テーマは”冬”です。
ソースプログラムは、下の表をみてください。 Program 1-5 winter.wrl #VRML V2.0 utf8 DEF YUKIDARUMA Transform { translation 0 0 0 children [ DEF yukidaruma Transform { translation -2 -4 0 children [ Inline { url "yukidaruma.wrl"}] } ] } DEF house Transform { translation -3 -3 -3 children [ Inline { url "house.wrl"}] } DEF tree Transform { translation 0 0 0 children [ DEF tree1 Transform { translation -6 -3 -3 children [ Inline { url "tree.wrl"}] } DEF tree2 Transform { translation 0 -3 -3 children [ Inline { url "tree.wrl"}] } DEF tree2 Transform { translation -2 -3 -0 children [ Inline { url "tree.wrl"}] } ] } DEF T TimeSensor { loop TRUE enabled TRUE cycleInterval 10 stopTime -1 } DEF P PositionInterpolator { key [ 0, 0.5, 1] keyValue [ 0 0 -10, 10 0 0, 10 0 -10] } ROUTE T.fraction_changed TO P.set_fraction ROUTE P.value_changed TO YUKIDARUMA.translation 実際では色が鮮やかです。見たい方は■winter.wrlをクリックしてください。
ソースプログラムは、下の表をみてください。
Program 1-5 winter.wrl
#VRML V2.0 utf8 DEF YUKIDARUMA Transform { translation 0 0 0 children [ DEF yukidaruma Transform { translation -2 -4 0 children [ Inline { url "yukidaruma.wrl"}] } ] } DEF house Transform { translation -3 -3 -3 children [ Inline { url "house.wrl"}] } DEF tree Transform { translation 0 0 0 children [ DEF tree1 Transform { translation -6 -3 -3 children [ Inline { url "tree.wrl"}] } DEF tree2 Transform { translation 0 -3 -3 children [ Inline { url "tree.wrl"}] } DEF tree2 Transform { translation -2 -3 -0 children [ Inline { url "tree.wrl"}] } ] } DEF T TimeSensor { loop TRUE enabled TRUE cycleInterval 10 stopTime -1 } DEF P PositionInterpolator { key [ 0, 0.5, 1] keyValue [ 0 0 -10, 10 0 0, 10 0 -10] } ROUTE T.fraction_changed TO P.set_fraction ROUTE P.value_changed TO YUKIDARUMA.translation