{ "X3D": {
    "encoding":"UTF-8",
    "@profile":"Interchange",
    "@version":"3.0",
    "@xsd:noNamespaceSchemaLocation":"https://www.web3d.org/specifications/x3d-3.0.xsd",
    "JSON schema":"https://www.web3d.org/specifications/x3d-4.0-JSONSchema.autogenerated.json",
    "head": {
        "meta": [
          {
            "@name":"title",
            "@content":"DraggingSphere.x3d"
          },
          {
            "@name":"description",
            "@content":"A sphere that drags its tail around a box in the XY-plane"
          },
          {
            "@name":"creator",
            "@content":"Matthew Braun"
          },
          {
            "@name":"created",
            "@content":"24 July 2001"
          },
          {
            "@name":"modified",
            "@content":"20 October 2019"
          },
          {
            "@name":"rights",
            "@content":"Copyright (c) Matthew Braun, 2001"
          },
          {
            "@name":"identifier",
            "@content":"https://www.web3d.org/x3d/content/examples/Basic/StudentProjects/DraggingSphere.x3d"
          },
          {
            "@name":"generator",
            "@content":"X3D-Edit 3.3, https://www.web3d.org/x3d/tools/X3D-Edit"
          },
          {
            "@name":"license",
            "@content":"../license.html"
          },
          {
            "@name":"translated",
            "@content":"20 April 2026"
          },
          {
            "@name":"generator",
            "@content":"X3dToJson.xslt, https://www.web3d.org/x3d/stylesheets/X3dToJson.html"
          },
          {
            "@name":"reference",
            "@content":"X3D JSON encoding: https://www.web3d.org/wiki/index.php/X3D_JSON_Encoding"
          }
        ]
    },
    "Scene": {
        "-children":[
          {
            "#comment":"The scene is composed of two spheres and one cylinder. The spheres move in a box in the xy-plane. The cylinder moves in the same box, and expands and rotates to give the appearance of stretching between the spheres."
          },
          { "WorldInfo":
            {
              "@title":"DraggingSphere.x3d"
            }
          },
          { "Group":
            {
              "-children":[
                { "Viewpoint":
                  {
                    "@description":"Start",
                    "@position":[-2,2,7]
                  }
                },
                {
                  "#comment":"The leading sphere"
                },
                { "Transform":
                  {
                    "@DEF":"SPHERETF1",
                    "-children":[
                      { "Shape":
                        {
                          "@DEF":"SPHERE",
                          "-appearance":
                            { "Appearance":
                              {
                                "-material":
                                  { "Material":
                                    {
                                      "@DEF":"SPH_MAT",
                                      "@ambientIntensity":0.9,
                                      "@diffuseColor":[0.0,0.0,0.0]
                                    }
                                  }
                              }
                            },
                          "-geometry":
                            { "Sphere":
                              {
                                "@radius":0.5
                              }
                            }
                        }
                      }
                    ]
                  }
                },
                {
                  "#comment":"Trailing sphere"
                },
                { "Transform":
                  {
                    "@DEF":"SPHERETF2",
                    "-children":[
                      { "Shape":
                        {
                          "@USE":"SPHERE"
                        }
                      }
                    ]
                  }
                },
                { "Transform":
                  {
                    "@DEF":"CYL_TF",
                    "@rotation":[0,0,-1,1.571],
                    "@scale":[1,2,1],
                    "@translation":[-1,0,0],
                    "-children":[
                      { "Shape":
                        {
                          "@DEF":"CYLSHAPE",
                          "-appearance":
                            { "Appearance":
                              {
                                "-material":
                                  { "Material":
                                    {
                                      "@USE":"SPH_MAT"
                                    }
                                  }
                              }
                            },
                          "-geometry":
                            { "Cylinder":
                              {
                                "@radius":0.50
                              }
                            }
                        }
                      }
                    ]
                  }
                }
              ]
            }
          },
          {
            "#comment":"ColorInt for diffuse and emissive color"
          },
          { "ColorInterpolator":
            {
              "@DEF":"ColorINT",
              "@key":[0,0.25,0.50,0.75,1.0],
              "@keyValue":[0.8,0.8,0.8,0.1,0.1,0.9,0.1,0.9,0.1,0.9,0.1,0.1,0.8,0.8,0.8]
            }
          },
          {
            "#comment":"PosInt for the first sphere: a square in the XY-plane."
          },
          { "PositionInterpolator":
            {
              "@DEF":"POSINT1",
              "@key":[0,0.08,0.16,0.25,0.33,0.41,0.50,0.58,0.66,0.75,0.83,0.91,1.0],
              "@keyValue":[0.0,0.0,0.0,-2.0,0.0,0.0,-4.0,0.0,0.0,-4.0,0.0,0.0,-4.0,2.0,0.0,-4.0,4.0,0.0,-4.0,4.0,0.0,-2.0,4.0,0.0,0.0,4.0,0.0,0.0,4.0,0.0,0.0,2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]
            }
          },
          {
            "#comment":"PosInt for second Sphere:a square in the XY-plane."
          },
          { "PositionInterpolator":
            {
              "@DEF":"POSINT2",
              "@key":[0,0.08,0.16,0.25,0.33,0.41,0.50,0.58,0.66,0.75,0.83,0.91,1.0],
              "@keyValue":[0.0,0.0,0.0,0.0,0.0,0.0,-2.0,0.0,0.0,-4.0,0.0,0.0,-4.0,0.0,0.0,-4.0,2.0,0.0,-4.0,4.0,0.0,-4.0,4.0,0.0,-2.0,4.0,0.0,0.0,4.0,0.0,0.0,4.0,0.0,0.0,2.0,0.0,0.0,0.0,0.0]
            }
          },
          {
            "#comment":"PosInt for the Cylinder: a square in the XY-plane."
          },
          { "PositionInterpolator":
            {
              "@DEF":"POSINT3",
              "@key":[0,0.08,0.16,0.25,0.33,0.41,0.50,0.58,0.66,0.75,0.83,0.91,1.0],
              "@keyValue":[0.0,0.0,0.0,-1.0,0.0,0.0,-3.0,0.0,0.0,-4.0,0.0,0.0,-4.0,1.0,0.0,-4.0,3.0,0.0,-4.0,4.0,0.0,-3.0,4.0,0.0,-1.0,4.0,0.0,0.0,4.0,0.0,0.0,3.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0]
            }
          },
          {
            "#comment":"OrientationINT for the Cylinder."
          },
          { "OrientationInterpolator":
            {
              "@DEF":"OrientINT",
              "@key":[0.00,0.25,0.25,0.50,0.50,0.75,0.75,1.00],
              "@keyValue":[0,0,1,1.57,0,0,1,1.57,0,0,0,0,0,0,0,0,0,0,1,1.57,0,0,1,1.57,0,0,0,0,0,0,0,0]
            }
          },
          {
            "#comment":"ScalarInt for cylinder height."
          },
          { "PositionInterpolator":
            {
              "@DEF":"ScalarInt",
              "@key":[0,0.08,0.16,0.25,0.33,0.41,0.50,0.58,0.66,0.75,0.83,0.91,1.0],
              "@keyValue":[1,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0,1]
            }
          },
          {
            "#comment":"World clock for all objects."
          },
          { "TimeSensor":
            {
              "@DEF":"CLOCK1",
              "@cycleInterval":6,
              "@loop":true
            }
          },
          {
            "#comment":"Routes from clock to first sphere"
          },
          { "ROUTE":
            {
              "@fromField":"fraction_changed",
              "@fromNode":"CLOCK1",
              "@toField":"set_fraction",
              "@toNode":"POSINT1"
            }
          },
          { "ROUTE":
            {
              "@fromField":"value_changed",
              "@fromNode":"POSINT1",
              "@toField":"set_translation",
              "@toNode":"SPHERETF1"
            }
          },
          {
            "#comment":"Routes from clock to second sphere"
          },
          { "ROUTE":
            {
              "@fromField":"fraction_changed",
              "@fromNode":"CLOCK1",
              "@toField":"set_fraction",
              "@toNode":"POSINT2"
            }
          },
          { "ROUTE":
            {
              "@fromField":"value_changed",
              "@fromNode":"POSINT2",
              "@toField":"set_translation",
              "@toNode":"SPHERETF2"
            }
          },
          {
            "#comment":"Routes from clock to first sphere"
          },
          { "ROUTE":
            {
              "@fromField":"fraction_changed",
              "@fromNode":"CLOCK1",
              "@toField":"set_fraction",
              "@toNode":"ColorINT"
            }
          },
          { "ROUTE":
            {
              "@fromField":"value_changed",
              "@fromNode":"ColorINT",
              "@toField":"set_diffuseColor",
              "@toNode":"SPH_MAT"
            }
          },
          { "ROUTE":
            {
              "@fromField":"value_changed",
              "@fromNode":"ColorINT",
              "@toField":"set_emissiveColor",
              "@toNode":"SPH_MAT"
            }
          },
          {
            "#comment":"Routes for Cylinder movement"
          },
          { "ROUTE":
            {
              "@fromField":"fraction_changed",
              "@fromNode":"CLOCK1",
              "@toField":"set_fraction",
              "@toNode":"POSINT3"
            }
          },
          { "ROUTE":
            {
              "@fromField":"value_changed",
              "@fromNode":"POSINT3",
              "@toField":"set_translation",
              "@toNode":"CYL_TF"
            }
          },
          {
            "#comment":"Routes for Cylinder rotation"
          },
          { "ROUTE":
            {
              "@fromField":"fraction_changed",
              "@fromNode":"CLOCK1",
              "@toField":"set_fraction",
              "@toNode":"OrientINT"
            }
          },
          { "ROUTE":
            {
              "@fromField":"value_changed",
              "@fromNode":"OrientINT",
              "@toField":"set_rotation",
              "@toNode":"CYL_TF"
            }
          },
          {
            "#comment":"Routes for Cylinder stretching"
          },
          { "ROUTE":
            {
              "@fromField":"fraction_changed",
              "@fromNode":"CLOCK1",
              "@toField":"set_fraction",
              "@toNode":"ScalarInt"
            }
          },
          { "ROUTE":
            {
              "@fromField":"value_changed",
              "@fromNode":"ScalarInt",
              "@toField":"set_scale",
              "@toNode":"CYL_TF"
            }
          }
        ]
    }
  }
}