{ "X3D": {
    "encoding":"UTF-8",
    "@profile":"Immersive",
    "@version":"3.0",
    "@xsd:noNamespaceSchemaLocation":"http://www.web3d.org/specifications/x3d-3.0.xsd",
    "JSON schema":"http://www.web3d.org/specifications/x3d-3.3-JSONSchema.json",
    "head": {
        "meta": [
          {
            "@name":"title",
            "@content":"Figure30.4ScriptSpiralingBallTrace.x3d"
          },
          {
            "@name":"creator",
            "@content":"Figure 30.4, The VRML 2.0 Sourcebook, Copyright [1997] By Andrea L. Ames, David R. Nadeau, and John L. Moreland"
          },
          {
            "@name":"reference",
            "@content":"http://www.wiley.com/legacy/compbooks/vrml2sbk/ch30/30fig04.htm"
          },
          {
            "@name":"translator",
            "@content":"Don Brutzman"
          },
          {
            "@name":"created",
            "@content":"2 September 2000"
          },
          {
            "@name":"modified",
            "@content":"11 January 2014"
          },
          {
            "@name":"description",
            "@content":"A spiraling red sphere and a custom interpolation script."
          },
          {
            "@name":"identifier",
            "@content":"http://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter30-Scripts/Figure30.4ScriptSpiralingBallTrace.x3d"
          },
          {
            "@name":"generator",
            "@content":"X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit"
          },
          {
            "@name":"license",
            "@content":"../../license.html"
          },
          {
            "@name":"translated",
            "@content":"19 March 2017"
          },
          {
            "@name":"generator",
            "@content":"X3dToJson.xslt, http://www.web3d.org/x3d/stylesheets/X3dToJson.html"
          },
          {
            "@name":"warning",
            "@content":"An experimental version of X3D JSON encoding is used for this scene.  Status online at http://www.web3d.org/wiki/index.php/X3D_JSON_Encoding"
          }
        ]
    },
    "Scene": {
        "-children":[
          { "Viewpoint":
            {
              "@description":"spiraling ball",
              "@orientation":[1,0,0,-0.3],
              "@position":[0,3,8]
            }
          },
          { "Viewpoint":
            {
              "@description":"view from above",
              "@orientation":[1,0,0,-1.57],
              "@position":[0,6,0]
            }
          },
          { "Viewpoint":
            {
              "@description":"side view",
              "@orientation":[0,1,0,1.57],
              "@position":[6,1,0]
            }
          },
          {
            "#comment":"Background nodes are usually best placed at the top of the scene since they have global effect and are bindable nodes."
          },
          { "Background":
            {
              "@groundAngle":[1.309,1.570796],
              "@groundColor":[0,0.1,0.3,0.3,0.3,0.6,0.4,0.4,0.6],
              "@skyAngle":[1.309,1.571],
              "@skyColor":[1,0,0.8,0.5,0,0.8,0,0,0.8]
            }
          },
          { "Group":
            {
              "-children":[
                { "Transform":
                  {
                    "@translation":[0,-0.005,0],
                    "-children":[
                      { "Shape":
                        {
                          "-geometry":
                            { "Box":
                              {
                                "@size":[2,0.01,4]
                              }
                            },
                          "-appearance":
                            { "Appearance":
                              {
                                "-material":
                                  { "Material":
                                    {
                                      "@diffuseColor":[0.7,0.7,0.7]
                                    }
                                  }
                              }
                            }
                        }
                      }
                    ]
                  }
                },
                { "Transform":
                  {
                    "@translation":[0,1.1,0],
                    "-children":[
                      { "Transform":
                        {
                          "@DEF":"BallTransform",
                          "-children":[
                            { "Shape":
                              {
                                "-appearance":
                                  { "Appearance":
                                    {
                                      "-material":
                                        { "Material":
                                          {
                                            "@diffuseColor":[1,0.3,0.3]
                                          }
                                        }
                                    }
                                  },
                                "-geometry":
                                  { "Sphere":
                                    {
                                      "@radius":0.1
                                    }
                                  }
                              }
                            }
                          ]
                        }
                      }
                    ]
                  }
                },
                { "TimeSensor":
                  {
                    "@DEF":"Clock",
                    "@cycleInterval":10,
                    "@loop":true
                  }
                },
                { "Script":
                  {
                    "@DEF":"Mover",
                    "field": [
                      {
                        "@name":"set_fraction",
                        "@accessType":"inputOnly",
                        "@type":"SFFloat"
                      },
                      {
                        "@name":"value_changed",
                        "@accessType":"outputOnly",
                        "@type":"SFVec3f"
                      },
                      {
                        "@name":"radius",
                        "@accessType":"initializeOnly",
                        "@type":"SFFloat",
                        "@value":1
                      },
                      {
                        "@name":"turns",
                        "@accessType":"initializeOnly",
                        "@type":"SFFloat",
                        "@value":4
                      }
                    ],
                    "#sourceText":[
"ecmascript:",
"",
"function set_fraction ( fraction, eventTime ) {",
"\tvalue_changed[0] = radius * Math.sin( turns * fraction * 6.28 ); // x",
"\tvalue_changed[1] = radius * Math.cos( turns * fraction * 6.28 ); // y",
"\tvalue_changed[2] = turns * (fraction - 0.5);                     // z",
"}"
]
                  }
                },
                { "Script":
                  {
                    "@DEF":"Debug",
                    "field": [
                      {
                        "@name":"label",
                        "@accessType":"initializeOnly",
                        "@type":"SFString",
                        "@value":"fraction"
                      },
                      {
                        "@name":"set_float",
                        "@accessType":"inputOnly",
                        "@type":"SFFloat"
                      },
                      {
                        "@name":"string_changed",
                        "@accessType":"outputOnly",
                        "@type":"MFString"
                      }
                    ],
                    "#sourceText":[
"ecmascript:",
"",
"function initalize( )",
"{",
"\tstring_changed[0] = label + ':';",
"}",
"function set_float( value, timestamp )",
"{",
"\tstring_changed[0] = label + ': ' + Math.round (value * 100) / 100;",
"}"
]
                  }
                },
                { "Transform":
                  {
                    "@translation":[0,0.5,0],
                    "-children":[
                      { "Billboard":
                        {
                          "@axisOfRotation":[0,0,0],
                          "-children":[
                            { "Shape":
                              {
                                "-geometry":
                                  { "Text":
                                    {
                                      "@DEF":"Message",
                                      "-fontStyle":
                                        { "FontStyle":
                                          {
                                            "@justify":["MIDDLE","MIDDLE"],
                                            "@size":0.3
                                          }
                                        }
                                    }
                                  },
                                "-appearance":
                                  { "Appearance":
                                    {
                                      "-material":
                                        { "Material":
                                          {
                                            "@diffuseColor":[0,0,0],
                                            "@emissiveColor":[0,1,1]
                                          }
                                        }
                                    }
                                  }
                              }
                            }
                          ]
                        }
                      }
                    ]
                  }
                },
                { "Transform":
                  {
                    "@rotation":[1,0,0,1.57079],
                    "@translation":[0,1.1,0],
                    "-children":[
                      { "Shape":
                        {
                          "-appearance":
                            { "Appearance":
                              {
                                "-material":
                                  { "Material":
                                    {
                                      "@diffuseColor":[0.5,0,0],
                                      "@transparency":0.7
                                    }
                                  }
                              }
                            },
                          "-geometry":
                            { "Cylinder":
                              {
                                "@height":4
                              }
                            }
                        }
                      }
                    ]
                  }
                }
              ]
            }
          },
          { "ROUTE":
            {
              "@fromField":"fraction_changed",
              "@fromNode":"Clock",
              "@toField":"set_fraction",
              "@toNode":"Mover"
            }
          },
          { "ROUTE":
            {
              "@fromField":"value_changed",
              "@fromNode":"Mover",
              "@toField":"set_translation",
              "@toNode":"BallTransform"
            }
          },
          { "ROUTE":
            {
              "@fromField":"fraction_changed",
              "@fromNode":"Clock",
              "@toField":"set_float",
              "@toNode":"Debug"
            }
          },
          { "ROUTE":
            {
              "@fromField":"string_changed",
              "@fromNode":"Debug",
              "@toField":"set_string",
              "@toNode":"Message"
            }
          }
        ]
    }
  }
}