{ "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":"Figure31.9SpinGroupPrototype.x3d"
          },
          {
            "@name":"creator",
            "@content":"Figure 31.9, 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/ch31/31fig09.htm"
          },
          {
            "@name":"translator",
            "@content":"Don Brutzman"
          },
          {
            "@name":"created",
            "@content":"24 October 2000"
          },
          {
            "@name":"modified",
            "@content":"15 January 2011"
          },
          {
            "@name":"description",
            "@content":"A SpinGroup node type used to automatically spin a group of three boxes. Click on blue crossbar to activate second SpinGroup."
          },
          {
            "@name":"identifier",
            "@content":"http://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter31-Prototypes/Figure31.9SpinGroupPrototype.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":[
          { "ProtoDeclare":
            {
              "@name":"SpinGroup",
              "ProtoInterface": {
                  "field": [
                    {
                      "@name":"children",
                      "@accessType":"inputOutput",
                      "@type":"MFNode",
                      "-children":[
                        {
                          "#comment":"NULL node initialization"
                        }
                      ]
                    },
                    {
                      "@name":"cycleInterval",
                      "@accessType":"inputOutput",
                      "@type":"SFTime",
                      "@value":1
                    },
                    {
                      "@name":"loop",
                      "@accessType":"inputOutput",
                      "@type":"SFBool",
                      "@value":false
                    },
                    {
                      "@name":"startTime",
                      "@accessType":"inputOutput",
                      "@type":"SFTime",
                      "@value":0
                    },
                    {
                      "@name":"stopTime",
                      "@accessType":"inputOutput",
                      "@type":"SFTime",
                      "@value":0
                    }
                  ]
              },
              "ProtoBody": {
                  "-children":[
                    { "Transform":
                      {
                        "@DEF":"SpinGroupTransform",
                        "IS": {
                            "connect": [
                              {
                                "@nodeField":"children",
                                "@protoField":"children"
                              }
                            ]
                        }
                      }
                    },
                    {
                      "#comment":"following nodes will not be rendered, only the first node of a ProtoBody is drawn"
                    },
                    { "TimeSensor":
                      {
                        "@DEF":"SpinGroupClock",
                        "IS": {
                            "connect": [
                              {
                                "@nodeField":"cycleInterval",
                                "@protoField":"cycleInterval"
                              },
                              {
                                "@nodeField":"loop",
                                "@protoField":"loop"
                              },
                              {
                                "@nodeField":"startTime",
                                "@protoField":"startTime"
                              },
                              {
                                "@nodeField":"stopTime",
                                "@protoField":"stopTime"
                              }
                            ]
                        }
                      }
                    },
                    { "OrientationInterpolator":
                      {
                        "@DEF":"Spinner",
                        "@key":[0,0.5,1],
                        "@keyValue":[0,1,0,0,0,1,0,3.14,0,1,0,6.28]
                      }
                    },
                    { "ROUTE":
                      {
                        "@fromField":"fraction_changed",
                        "@fromNode":"SpinGroupClock",
                        "@toField":"set_fraction",
                        "@toNode":"Spinner"
                      }
                    },
                    { "ROUTE":
                      {
                        "@fromField":"value_changed",
                        "@fromNode":"Spinner",
                        "@toField":"set_rotation",
                        "@toNode":"SpinGroupTransform"
                      }
                    }
                  ]
              }
            }
          },
          {
            "#comment":"Now the scene proper begins. Nothing renders in a ProtoDeclare (or ExternProtoDeclare)."
          },
          { "Viewpoint":
            {
              "@description":"Click on blue crossbar to activate second SpinGroup",
              "@orientation":[1,0,0,-0.52],
              "@position":[0,18,30]
            }
          },
          {
            "#comment":"Create an instance, meaning actual nodes that render"
          },
          { "ProtoInstance":
            {
              "@name":"SpinGroup",
              "fieldValue": [
                {
                  "@name":"cycleInterval",
                  "@value":8
                },
                {
                  "@name":"loop",
                  "@value":true
                },
                {
                  "@name":"children",
                  "-children":[
                    { "Shape":
                      {
                        "-geometry":
                          { "Box":
                            {
                              "@size":[25,2,2]
                            }
                          },
                        "-appearance":
                          { "Appearance":
                            {
                              "@DEF":"Green",
                              "-material":
                                { "Material":
                                  {
                                    "@diffuseColor":[0,1,0.3]
                                  }
                                }
                            }
                          }
                      }
                    },
                    { "Shape":
                      {
                        "-geometry":
                          { "Box":
                            {
                              "@size":[2,25,2]
                            }
                          },
                        "-appearance":
                          { "Appearance":
                            {
                              "@USE":"Green"
                            }
                          }
                      }
                    },
                    { "ProtoInstance":
                      {
                        "@name":"SpinGroup",
                        "@DEF":"SecondSpinGroup",
                        "fieldValue": [
                          {
                            "@name":"cycleInterval",
                            "@value":4
                          },
                          {
                            "@name":"loop",
                            "@value":true
                          },
                          {
                            "@name":"stopTime",
                            "@value":1
                          },
                          {
                            "@name":"children",
                            "-children":[
                              { "TouchSensor":
                                {
                                  "@DEF":"ActivateSecondSpinGroup",
                                  "@description":"Activate second SpinGroup by clicking blue bar"
                                }
                              },
                              { "Shape":
                                {
                                  "-geometry":
                                    { "Box":
                                      {
                                        "@size":[2,2.05,25]
                                      }
                                    },
                                  "-appearance":
                                    { "Appearance":
                                      {
                                        "-material":
                                          { "Material":
                                            {
                                              "@diffuseColor":[0,0.3,1]
                                            }
                                          }
                                      }
                                    }
                                }
                              }
                            ]
                          }
                        ],
                        "-children":[
                          {
                            "#comment":"stopTime > startTime ensures that initial state is stopped"
                          }
                        ]
                      }
                    }
                  ]
                }
              ]
            }
          },
          { "ROUTE":
            {
              "@fromField":"touchTime",
              "@fromNode":"ActivateSecondSpinGroup",
              "@toField":"startTime",
              "@toNode":"SecondSpinGroup"
            }
          }
        ]
    }
  }
}