#VRML V2.0 utf8 WorldInfo { title "Rainbow Text 4" info [ "2001/10/8 Ver1.1 by GoGoGo" "http://www1.plala.or.jp/Studio_GoGoGo/" ] } Viewpoint {} #文字テクスチャを貼ったプレートの PROTO PROTO TexPlate [ field SFVec3f translation 0 0 0 exposedField MFVec2f point [] eventIn SFTime start ] { Transform { translation IS translation children [ Shape { appearance Appearance { material DEF m Material {diffuseColor 0 0 0.001} texture ImageTexture {url "s_ggg02.gif"} } geometry IndexedFaceSet { coord Coordinate { point [-0.25 -0.5 0, 0.25 -0.5 0, 0.25 0.5 0, -0.25 0.5 0] } coordIndex [0 1 2 3] texCoord TextureCoordinate {point IS point} solid FALSE } } ] } DEF colorTimer TimeSensor { cycleInterval 5 startTime IS start } DEF PI PositionInterpolator {#色変化用 key [0 0.1 0.85 1] keyValue [0 0 0.001, 0 1 1, 0.833 1 1, 0.833 0 0.001] } DEF colorSC Script { eventIn SFVec3f valueIn eventOut SFColor colorOut url "javascript: function valueIn(value) { colorOut.setHSV(value.x,value.y,value.z); }" } ROUTE colorTimer.fraction_changed TO PI.set_fraction ROUTE PI.value_changed TO colorSC.valueIn ROUTE colorSC.colorOut TO m.set_diffuseColor } #文字テクスチャを貼ったプレートを14個 DEF A1 TexPlate {translation -4 0 0} DEF S TexPlate {translation -3 0 0} DEF T TexPlate {translation -2.5 0 0} DEF U TexPlate {translation -2 0 0} DEF D TexPlate {translation -1.5 0 0} DEF I TexPlate {translation -1 0 0} DEF O TexPlate {translation -0.5 0 0} DEF G1 TexPlate {translation 0.5 0 0} DEF O1 TexPlate {translation 1 0 0} DEF G2 TexPlate {translation 1.5 0 0} DEF O2 TexPlate {translation 2 0 0} DEF G3 TexPlate {translation 2.5 0 0} DEF O3 TexPlate {translation 3 0 0} DEF A2 TexPlate {translation 4 0 0} #colorTimer 順次スタート用タイマー DEF Timer TimeSensor {loop TRUE cycleInterval 0.2} #文字テクスチャを文字数で等分し(等幅フォントを使用しているので等分が可能), #また,colorTimer を順次スタートさせるスクリプト DEF SC Script { eventOut MFVec2f pointA eventOut MFVec2f pointS eventOut MFVec2f pointT eventOut MFVec2f pointU eventOut MFVec2f pointD eventOut MFVec2f pointI eventOut MFVec2f pointO eventOut MFVec2f pointG field SFInt32 div 8 #テクスチャの文字数([*,S,t,u,d,i,o,G] の8文字) eventIn SFTime cycleTime eventOut SFTime startA1 eventOut SFTime startS eventOut SFTime startT eventOut SFTime startU eventOut SFTime startD eventOut SFTime startI eventOut SFTime startO eventOut SFTime startG1 eventOut SFTime startO1 eventOut SFTime startG2 eventOut SFTime startO2 eventOut SFTime startG3 eventOut SFTime startO3 eventOut SFTime startA2 field SFInt32 count 0 url "javascript: function initialize() { point=new Array(div); for (i=0;i