{ "X3D": {
    "encoding":"UTF-8",
    "@profile":"Immersive",
    "@version":"4.0",
    "@xsd:noNamespaceSchemaLocation":"https://www.web3d.org/specifications/x3d-4.0.xsd",
    "JSON schema":"https://www.web3d.org/specifications/x3d-4.0-JSONSchema.autogenerated.json",
    "head": {
        "meta": [
          {
            "@name":"title",
            "@content":"ECMAScriptSaiPerFrameNotification.x3d"
          },
          {
            "@name":"description",
            "@content":"Java Scene Authoring Interface (JSAI) scene and source code example that show how to use per frame notification to produce a frame rate annotation."
          },
          {
            "@name":"creator",
            "@content":"X3D Working Group"
          },
          {
            "@name":"created",
            "@content":"23 February 2005"
          },
          {
            "@name":"modified",
            "@content":"28 September 2025"
          },
          {
            "@name":"reference",
            "@content":"https://www.web3d.org/files/specifications/19777-1/V3.3/Part1/X3D_ECMAScript.html"
          },
          {
            "@name":"specificationSection",
            "@content":"X3D language bindings, ISO/IEC 19777-1, Part 1: ECMAScript, B.4 Per frame notification"
          },
          {
            "@name":"specificationUrl",
            "@content":"https://www.web3d.org/files/specifications/19777-1/V3.3/Part1/examples.html#PerFrameNotification"
          },
          {
            "@name":"generator",
            "@content":"X3D-Edit 4.0, https://www.web3d.org/x3d/tools/X3D-Edit"
          },
          {
            "@name":"identifier",
            "@content":"https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/ECMAScriptSaiPerFrameNotification.x3d"
          },
          {
            "@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":[
          { "WorldInfo":
            {
              "@title":"ECMAScriptSaiPerFrameNotification.x3d"
            }
          },
          { "Script":
            {
              "@DEF":"SC",
              "#sourceCode":[
"",
"",
"ecmascript:",
"var lastStartTime;",
"",
"function initialize() {",
"    date = new Date();",
"    lastStartTime = date.getTime();",
"}",
"",
"// Called each frame",
"function prepareEvents() {",
"    date = new Date();",
"    frameTime = (date.getTime() - lastStartTime) / 1000.0;",
"    lastStartTime = date.getTime();",
"    fps = 1.0 / frameTime;",
"    Browser.println('FPS: ' + fps);",
"}",
"",
""
]
            }
          }
        ]
    }
  }
}