#VRML V2.0 utf8 #視点設定 Viewpoint { position 0 0 3 } #光源設定 DirectionalLight { direction 0 -1 0 } #折り紙 DEF origami Transform { translation 0 -0.707 0 children [ DEF TS TouchSensor { } Shape { appearance Appearance { material Material { diffuseColor 1 1 1 transparency 0.3 } } geometry IndexedFaceSet { coord DEF origamiPoint Coordinate { point [ -1 0 1 #0 左前 0 0 1 #1 中前 1 0 1 #2 右前 1 0 0 #3 右中 1 0 -1 #4 右奥 0 0 -1 #5 中奥 -1 0 -1 #6 左奥 -1 0 0 #7 左中 0 0 0 #8 中心 ] } coordIndex [ 0 1 8 -1 1 2 8 -1 2 3 8 -1 3 4 8 -1 4 5 8 -1 5 6 8 -1 6 7 8 -1 7 0 8 -1 ] solid FALSE } } ] } #変形設定 DEF TIMER TimeSensor { cycleInterval 15 } DEF CI CoordinateInterpolator { key [0 1] keyValue [ -1 0 1 #変形前 0 0 1 1 0 1 1 0 0 1 0 -1 0 0 -1 -1 0 -1 -1 0 0 0 0 0 -0.01 0 0.01 #変形後 0 0.707 0.707 0.01 0 0.01 0.707 0.707 0 0.01 0 -0.01 0 0.707 -0.707 -0.01 0 -0.01 -0.707 0.707 0 0 1.414 0 ] } ROUTE TS.touchTime TO TIMER.startTime ROUTE TIMER.fraction_changed TO CI.set_fraction ROUTE CI.value_changed TO origamiPoint.set_point #回転 DEF roundScript Script { eventIn SFTime touchTime eventOut SFBool loop url "javascript: function touchTime(value){ loop=TRUE; }" } DEF roundTIMER TimeSensor { cycleInterval 10 } DEF OI OrientationInterpolator { key [0 0.5 1] keyValue [0 1 0 0, 0 1 0 3.14, 0 1 0 6.28] } ROUTE TS.touchTime TO roundScript.touchTime ROUTE TS.touchTime TO roundTIMER.startTime ROUTE roundScript.loop TO roundTIMER.loop ROUTE roundTIMER.fraction_changed TO OI.set_fraction ROUTE OI.value_changed TO origami.set_rotation |