{ "X3D": {
    "encoding":"UTF-8",
    "@profile":"Immersive",
    "@version":"3.3",
    "@xsd:noNamespaceSchemaLocation":"https://www.web3d.org/specifications/x3d-3.3.xsd",
    "JSON schema":"https://www.web3d.org/specifications/x3d-4.0-JSONSchema.autogenerated.json",
    "head": {
        "meta": [
          {
            "@name":"title",
            "@content":"BackgroundSequencer.x3d"
          },
          {
            "@name":"description",
            "@content":"Cycle through four Background nodes to show a time-of-day effect."
          },
          {
            "@name":"creator",
            "@content":"Dale Tourtelotte, Don Brutzman and MV4205 class"
          },
          {
            "@name":"created",
            "@content":"20 April 2009"
          },
          {
            "@name":"modified",
            "@content":"25 November 2024"
          },
          {
            "@name":"reference",
            "@content":"https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter11LightingEnvironmentalEffects/BackgroundColorsOnly.x3d"
          },
          {
            "@name":"subject",
            "@content":"X3D Background example"
          },
          {
            "@name":"identifier",
            "@content":"https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter11LightingEnvironmentalEffects/BackgroundSequencer.x3d"
          },
          {
            "@name":"generator",
            "@content":"X3D-Edit 3.3, https://www.web3d.org/x3d/tools/X3D-Edit"
          },
          {
            "@name":"license",
            "@content":"../license.html"
          },
          {
            "@name":"translated",
            "@content":"17 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":[
          { "WorldInfo":
            {
              "@title":"BackgroundSequencer.x3d"
            }
          },
          { "Transform":
            {
              "@translation":[0,3,0],
              "-children":[
                { "Shape":
                  {
                    "-geometry":
                      { "Text":
                        {
                          "@string":["Background Sequencer"],
                          "-fontStyle":
                            { "FontStyle":
                              {
                                "@justify":["MIDDLE","MIDDLE"]
                              }
                            }
                        }
                      },
                    "-appearance":
                      { "Appearance":
                        {
                          "-material":
                            { "Material":
                              {
                              }
                            }
                        }
                      }
                  }
                }
              ]
            }
          },
          { "TimeSensor":
            {
              "@DEF":"TimeOfDayClock",
              "@cycleInterval":12,
              "@loop":true
            }
          },
          { "IntegerSequencer":
            {
              "@DEF":"BackgroundSequencer",
              "@key":[0,0.25,0.5,0.75,1],
              "@keyValue":[0,1,2,3,0]
            }
          },
          { "ROUTE":
            {
              "@fromField":"fraction_changed",
              "@fromNode":"TimeOfDayClock",
              "@toField":"set_fraction",
              "@toNode":"BackgroundSequencer"
            }
          },
          { "Script":
            {
              "@DEF":"SelectorScript",
              "field": [
                {
                  "@name":"whichBackground",
                  "@accessType":"inputOnly",
                  "@type":"SFInt32"
                },
                {
                  "@name":"currentBackground",
                  "@accessType":"inputOutput",
                  "@type":"SFInt32",
                  "@value":-1
                },
                {
                  "@name":"bind0",
                  "@accessType":"outputOnly",
                  "@type":"SFBool"
                },
                {
                  "@name":"bind1",
                  "@accessType":"outputOnly",
                  "@type":"SFBool"
                },
                {
                  "@name":"bind2",
                  "@accessType":"outputOnly",
                  "@type":"SFBool"
                },
                {
                  "@name":"bind3",
                  "@accessType":"outputOnly",
                  "@type":"SFBool"
                }
              ],
              "#sourceCode":[
"",
"",
"ecmascript:",
"function whichBackground (inputValue)",
"{",
"    if (currentBackground == inputValue)",
"        return; // avoid rapid Background binding (probably overcautious)",
"    currentBackground = inputValue; // remember state",
"    Browser.println ('currentBackground=' + currentBackground);",
"    if      (inputValue == 0) bind0 = true; // send event",
"    else if (inputValue == 1) bind1 = true; // send event",
"    else if (inputValue == 2) bind2 = true; // send event",
"    else if (inputValue == 3) bind3 = true; // send event",
"}",
"",
""
]
            }
          },
          { "ROUTE":
            {
              "@fromField":"value_changed",
              "@fromNode":"BackgroundSequencer",
              "@toField":"whichBackground",
              "@toNode":"SelectorScript"
            }
          },
          { "Background":
            {
              "@DEF":"SunRiseSky",
              "@groundAngle":[0.75,1.2,1.25,1.26,1.5,1.57],
              "@groundColor":[0.133333,0.419608,0,0.36,0.1,0,1,0.74,0.4,1,0.74,0.4,0,0,0.5,0,0,0.2,0,0.231373,0.380392],
              "@skyAngle":[0.5,0.7,1.35,1.45,1.57],
              "@skyColor":[0,0.035,0.34,0,0.015,0.44,0,0.05,0.5,0,0.1,0.6,0.44,0.8,1,1,1,0.7]
            }
          },
          { "Background":
            {
              "@DEF":"HighNoonSky",
              "@groundAngle":[0.75,1.2,1.25,1.26,1.57],
              "@groundColor":[0.133333,0.419608,0,0.36,0.1,0,1,0.74,0.4,1,0.74,0.4,0,0.2,0.75,0,0.1,0.5],
              "@skyAngle":[0.05,0.07,1.57],
              "@skyColor":[1,1,0.2,1,1,0,0.36,0.63,1,0,0.4,1]
            }
          },
          { "Background":
            {
              "@DEF":"SunsetSky",
              "@groundAngle":[0.75,1.2,1.25,1.26,1.57],
              "@groundColor":[0.133333,0.419608,0,0.36,0.1,0,1,0.74,0.4,1,0.74,0.4,0,0,0.5,0,0,0.2],
              "@skyAngle":[0.5,0.7,1.2,1.4,1.57],
              "@skyColor":[0,0,0.38,0,0,0.68,0.5,0.2,1,0.5,0.2,1,1,0.3,0,1,0.2,0.8]
            }
          },
          { "Background":
            {
              "@DEF":"NightSky",
              "@groundAngle":[0.75,1.2,1.25,1.26,1.57],
              "@groundColor":[0.133333,0.419608,0,0.36,0.1,0,1,0.74,0.4,1,0.74,0.4,0,0,0.5,0,0,0.2],
              "@skyAngle":[0.03,0.05,1.57],
              "@skyColor":[1,1,1,0.8,0.8,0.8,0.1,0.1,0.1,0,0,0]
            }
          },
          { "ROUTE":
            {
              "@fromField":"bind0",
              "@fromNode":"SelectorScript",
              "@toField":"set_bind",
              "@toNode":"SunRiseSky"
            }
          },
          { "ROUTE":
            {
              "@fromField":"bind1",
              "@fromNode":"SelectorScript",
              "@toField":"set_bind",
              "@toNode":"HighNoonSky"
            }
          },
          { "ROUTE":
            {
              "@fromField":"bind2",
              "@fromNode":"SelectorScript",
              "@toField":"set_bind",
              "@toNode":"SunsetSky"
            }
          },
          { "ROUTE":
            {
              "@fromField":"bind3",
              "@fromNode":"SelectorScript",
              "@toField":"set_bind",
              "@toNode":"NightSky"
            }
          }
        ]
    }
  }
}