Changing camera from the html
03 February 2017 09:39
Hello B4W!
I have looked at the Camera Animation example (https://www.blend4web.com/apps/code_snippets/code_snippets.html?scene=camera_animation) and I know how to make the camera change target and positionning. The animation trigger is in the canvas managed by B4W.
What I want to learn is how to make a link (the javascript link) located in the html page (not just in the canvas) trigger the animation.
DOM Tree:
html
body
<div id="B4W_Container"></div>
…
<div>Some text <a id="B4W_Trigger">go to Camera 01</a></div>
Programatically, what do I need to do this?
Best regards,
Eric
I have looked at the Camera Animation example (https://www.blend4web.com/apps/code_snippets/code_snippets.html?scene=camera_animation) and I know how to make the camera change target and positionning. The animation trigger is in the canvas managed by B4W.
What I want to learn is how to make a link (the javascript link) located in the html page (not just in the canvas) trigger the animation.
DOM Tree:
html
body
<div id="B4W_Container"></div>
…
<div>Some text <a id="B4W_Trigger">go to Camera 01</a></div>
Programatically, what do I need to do this?
Best regards,
Eric
03 February 2017 17:35
hi!
you can do it something like
should work!
you can do it something like
var mylink=document.getElementById("B4W_Trigger");
// replace the code in the example with the following:
mylink.addEventListener("mouseup", main_canvas_up);
mylink.addEventListener("mousedown", main_canvas_down);
should work!
04 February 2017 14:01