{ "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":"DEF_USE_AnimationExample.x3d"
          },
          {
            "@name":"description",
            "@content":"Illustrate how USE nodes implement copy by reference, resulting in immediate changes when original DEF node is modified. A single MasterMaterial node is animated, and changes in the parent MasterAppearance are reflected throughout the scene graph."
          },
          {
            "@name":"creator",
            "@content":"Don Brutzman"
          },
          {
            "@name":"modified",
            "@content":"1 September 2024"
          },
          {
            "@name":"Image",
            "@content":"DEF_USE_AnimationExampleScreenshot.png"
          },
          {
            "@name":"TODO",
            "@content":"X3D Specification Mantis Issue https://www.web3d.org/member-only/mantis/view.php?id=690"
          },
          {
            "@name":"reference",
            "@content":"Wikipedia: Evaluation strategy, pass by sharing https://en.wikipedia.org/wiki/Evaluation_strategy#Call_by_sharing"
          },
          {
            "@name":"specificationSection",
            "@content":"X3D 4.0 Architecture, ISO/IEC 19775-1:2023, clause 4 Concepts, 4.4.3 DEF/USE semantics"
          },
          {
            "@name":"specificationUrl",
            "@content":"https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-IS.proof/Part01/concepts.html#DEF_USE_Semantics"
          },
          {
            "@name":"reference",
            "@content":"https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter02GeometryPrimitives/GeometryPrimitiveNodes.x3d"
          },
          {
            "@name":"identifier",
            "@content":"https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/Animation/DEF_USE_AnimationExample.x3d"
          },
          {
            "@name":"generator",
            "@content":"Altova XMLSpy https://www.altova.com/xmlspy-xml-editor"
          },
          {
            "@name":"reference",
            "@content":"XMLSpyPrettyPrintSpacingTextViewSettings.png"
          },
          {
            "@name":"generator",
            "@content":"X3D-Edit 4.0 https://www.web3d.org/x3d/tools/X3D-Edit"
          },
          {
            "@name":"license",
            "@content":"../license.html"
          },
          {
            "@name":"translated",
            "@content":"16 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":"DEF_USE_AnimationExample.x3d"
            }
          },
          { "Background":
            {
              "@skyColor":[0.6,0.8,0.8]
            }
          },
          { "Viewpoint":
            {
              "@DEF":"EntryView",
              "@description":"DEF - USE Animation Example",
              "@position":[0,0,13]
            }
          },
          {
            "#comment":"Selectable Text design pattern has transparent Box and TouchSensor description as a tooltip"
          },
          { "TouchSensor":
            {
              "@DEF":"TopLevelTouchSensor",
              "@description":"select and hold to run animation"
            }
          },
          { "Group":
            {
              "-children":[
                { "Shape":
                  {
                    "@DEF":"TransparentSelectableBox",
                    "-geometry":
                      { "Box":
                        {
                          "@size":[16,8,0.001]
                        }
                      },
                    "-appearance":
                      { "Appearance":
                        {
                          "-material":
                            { "Material":
                              {
                                "@transparency":1
                              }
                            }
                        }
                      }
                  }
                },
                { "Transform":
                  {
                    "@DEF":"HighererRowTransform",
                    "@translation":[0,1.5,0],
                    "-children":[
                      { "Transform":
                        {
                          "@translation":[-5,0,0],
                          "-children":[
                            { "Shape":
                              {
                                "-geometry":
                                  { "Box":
                                    {
                                      "@DEF":"DefaultBox"
                                    }
                                  },
                                "-appearance":
                                  { "Appearance":
                                    {
                                      "@DEF":"MasterAppearance",
                                      "-material":
                                        { "Material":
                                          {
                                            "@DEF":"MasterMaterial",
                                            "@diffuseColor":[0.4,0.4,0.4]
                                          }
                                        }
                                    }
                                  }
                              }
                            },
                            { "Transform":
                              {
                                "@translation":[0,1.6,0],
                                "-children":[
                                  { "Shape":
                                    {
                                      "@DEF":"SmallDEFText",
                                      "-geometry":
                                        { "Text":
                                          {
                                            "@string":["DEF"],
                                            "-fontStyle":
                                              { "FontStyle":
                                                {
                                                  "@DEF":"SmallFontStyle",
                                                  "@justify":["MIDDLE","MIDDLE"],
                                                  "@size":0.5
                                                }
                                              }
                                          }
                                        },
                                      "-appearance":
                                        { "Appearance":
                                          {
                                            "@DEF":"TextAppearance",
                                            "-material":
                                              { "Material":
                                                {
                                                  "@diffuseColor":[1,1,1]
                                                }
                                              }
                                          }
                                        }
                                    }
                                  }
                                ]
                              }
                            }
                          ]
                        }
                      },
                      { "Transform":
                        {
                          "@translation":[-2.5,0,0],
                          "-children":[
                            { "Shape":
                              {
                                "-geometry":
                                  { "Cone":
                                    {
                                      "@DEF":"DefaultCone"
                                    }
                                  },
                                "-appearance":
                                  { "Appearance":
                                    {
                                      "@USE":"MasterAppearance"
                                    }
                                  }
                              }
                            },
                            { "Transform":
                              {
                                "@translation":[0,1.6,0],
                                "-children":[
                                  { "Shape":
                                    {
                                      "@DEF":"SmallUSEText",
                                      "-geometry":
                                        { "Text":
                                          {
                                            "@string":["USE"],
                                            "-fontStyle":
                                              { "FontStyle":
                                                {
                                                  "@USE":"SmallFontStyle"
                                                }
                                              }
                                          }
                                        },
                                      "-appearance":
                                        { "Appearance":
                                          {
                                            "@USE":"TextAppearance"
                                          }
                                        }
                                    }
                                  }
                                ]
                              }
                            }
                          ]
                        }
                      },
                      { "Transform":
                        {
                          "-children":[
                            { "Shape":
                              {
                                "-geometry":
                                  { "Cylinder":
                                    {
                                      "@DEF":"DefaultCylinder"
                                    }
                                  },
                                "-appearance":
                                  { "Appearance":
                                    {
                                      "@USE":"MasterAppearance"
                                    }
                                  }
                              }
                            },
                            { "Transform":
                              {
                                "@translation":[0,1.6,0],
                                "-children":[
                                  { "Shape":
                                    {
                                      "@USE":"SmallUSEText"
                                    }
                                  }
                                ]
                              }
                            }
                          ]
                        }
                      },
                      { "Transform":
                        {
                          "@translation":[2.5,0,0],
                          "-children":[
                            { "Shape":
                              {
                                "-geometry":
                                  { "Sphere":
                                    {
                                      "@DEF":"DefaultSphere"
                                    }
                                  },
                                "-appearance":
                                  { "Appearance":
                                    {
                                      "@USE":"MasterAppearance"
                                    }
                                  }
                              }
                            },
                            { "Transform":
                              {
                                "@translation":[0,1.6,0],
                                "-children":[
                                  { "Shape":
                                    {
                                      "@USE":"SmallUSEText"
                                    }
                                  }
                                ]
                              }
                            }
                          ]
                        }
                      },
                      { "Transform":
                        {
                          "@translation":[4,0,0],
                          "-children":[
                            { "Shape":
                              {
                                "-geometry":
                                  { "Text":
                                    {
                                      "@DEF":"DefaultText",
                                      "@string":["hello","X3D!"],
                                      "-fontStyle":
                                        { "FontStyle":
                                          {
                                            "@DEF":"DefaultFontStyle"
                                          }
                                        }
                                    }
                                  },
                                "-appearance":
                                  { "Appearance":
                                    {
                                      "@USE":"MasterAppearance"
                                    }
                                  }
                              }
                            },
                            { "Transform":
                              {
                                "@translation":[1.2,1.6,0],
                                "-children":[
                                  { "Shape":
                                    {
                                      "@USE":"SmallUSEText"
                                    }
                                  }
                                ]
                              }
                            }
                          ]
                        }
                      }
                    ]
                  }
                },
                { "TimeSensor":
                  {
                    "@DEF":"Clock",
                    "@cycleInterval":8,
                    "@enabled":false,
                    "@loop":true
                  }
                },
                { "ColorInterpolator":
                  {
                    "@DEF":"ColorChanger",
                    "@key":[0,0.5,0.5,0.75,1.0],
                    "@keyValue":[1,1,1,1,0,0,0,1,0,0,0,1,1,1,1]
                  }
                },
                { "ROUTE":
                  {
                    "@fromField":"isActive",
                    "@fromNode":"TopLevelTouchSensor",
                    "@toField":"enabled",
                    "@toNode":"Clock"
                  }
                },
                { "ROUTE":
                  {
                    "@fromField":"fraction_changed",
                    "@fromNode":"Clock",
                    "@toField":"set_fraction",
                    "@toNode":"ColorChanger"
                  }
                },
                { "ROUTE":
                  {
                    "@fromField":"value_changed",
                    "@fromNode":"ColorChanger",
                    "@toField":"diffuseColor",
                    "@toNode":"MasterMaterial"
                  }
                },
                { "Transform":
                  {
                    "@DEF":"LowerRowTransform",
                    "@translation":[0,-2,0],
                    "-children":[
                      { "Shape":
                        {
                          "-geometry":
                            { "Text":
                              {
                                "@DEF":"UserMessage",
                                "@string":["ColorInterpolator modifies one Material","in a single DEF=MasterAppearance node,","other USE nodes apply those values.","To animate, select and hold","using your pointing device."],
                                "-fontStyle":
                                  { "FontStyle":
                                    {
                                      "@DEF":"MessageFontStyle",
                                      "@justify":["MIDDLE","MIDDLE"],
                                      "@size":0.6,
                                      "@style":"BOLD"
                                    }
                                  }
                              }
                            },
                          "-appearance":
                            { "Appearance":
                              {
                                "-material":
                                  { "Material":
                                    {
                                      "@diffuseColor":[1,1,1]
                                    }
                                  }
                              }
                            }
                        }
                      }
                    ]
                  }
                }
              ]
            }
          }
        ]
    }
  }
}