Skip to content
Snippets Groups Projects
Commit ed768b13 authored by Michael Leuschel's avatar Michael Leuschel
Browse files

add 3D example for Button2

parent 9499b262
Branches
No related tags found
No related merge requests found
......@@ -2,7 +2,8 @@ MACHINE button2
// a version of button with just two events
DEFINITIONS
"LibraryMeta.def";
VISB_JSON_FILE == "button2.json"
VISB_JSON_FILE == "button2.json";
VISB_JSON_FILE2 == "button2_3d.json"
VARIABLES
button
INVARIANT
......
{
"svg": "x3dom_button.html",
"model": "button2.mch",
"model-name": "button2",
"items": [
{
"id": "button_%0",
"attr": "visible",
"value": "IF button=%0 THEN \"true\" ELSE \"false\" END",
"repeat": [ "TRUE", "FALSE" ]
},
{
"id": "box_col",
"attr": "diffuseColor",
"value": "IF button=TRUE THEN \"1 0 0\" ELSE \"0 1 0\" END"
}
],
"events": [
{
"id": "button",
"event": "press_button",
"hovers": [{ "id":"hover_message",
"attr":"text", "enter":"Press", "leave":""}]
},
{
"id": "button",
"event": "release_button"
},
{
"id": "button_TRUE",
"event": "",
"hovers": [{ "id":"hover_message",
"attr":"text", "enter":"Button=TRUE", "leave":""}]
},
{
"id": "button_FALSE",
"event": "",
"hovers": [{ "id":"hover_message",
"attr":"text", "enter":"Button=FALSE", "leave":""}]
}
]
}
<script type='text/javascript' src='https://www.x3dom.org/download/x3dom.js'> </script>
<link rel='stylesheet' type='text/css' href='https://www.x3dom.org/download/x3dom.css'></link>
<h1>Using X3DOM for VisB</h1>
<p>
This illustrates how one can use VisB to manipulated 3D Objects
</p>
<x3d width='500px' height='400px'>
<scene>
<transform id="box_trans" translation='0 0 0'>
<shape id="button">
<appearance>
<material id="box_col" diffuseColor='1 0 0'></material>
</appearance>
<box></box>
</shape>
<transform translation='-3 0 0'>
<shape id = "button_TRUE">
<appearance>
<material diffuseColor='0 1 0'></material>
</appearance>
<cone></cone>
</shape>
</transform>
<transform id="sphere_trans" translation='3 0 0'>
<shape id = "button_FALSE">
<appearance>
<material id="sphere_col" diffuseColor='0 0 1'></material>
</appearance>
<sphere></sphere>
</shape>
</transform>
</scene>
</x3d>
<ul>
<li>Message: <b><span id="hover_message"></span></b>
</li>
</ul>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment