0

is zk support with three.js ?

asked 2014-01-09 05:48:26 +0800

mujawarv gravatar image mujawarv flag of India
45 4

Hello all ; i am trying to display 3d view page develop in three.js in zk application but it will show blank , otherwise separate .html page with three.js will run properly

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2014-01-10 01:38:03 +0800

RaymondChao gravatar image RaymondChao
386 1 4

updated 2014-01-10 01:38:28 +0800

Hello mujawarv,

I tested the sample code from three.js with ZK and it worked fine.Is there any sample code or error message which could help me reproduce the problem?

The code I tested is as follow.

<zk>
  <div id="showThree"/>
  <script src="https://rawgithub.com/mrdoob/three.js/master/build/three.js"/>
  <script><![CDATA[
  zk.afterMount(function () {
    var scene = new THREE.Scene();
    var camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 1000);

    var renderer = new THREE.WebGLRenderer();
    renderer.setSize(window.innerWidth, window.innerHeight);

    jq('$showThree').append(renderer.domElement);

    var geometry = new THREE.CubeGeometry(1,1,1);
    var material = new THREE.MeshBasicMaterial({color: 0x00ff00});
    var cube = new THREE.Mesh(geometry, material);
    scene.add(cube);

    camera.position.z = 5;

    var render = function () {
      requestAnimationFrame(render);

      cube.rotation.x += 0.1;
      cube.rotation.y += 0.1;

      renderer.render(scene, camera);
    };
    render();
  });
  ]]></script>
</zk>
link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2014-01-09 05:48:26 +0800

Seen: 29 times

Last updated: Jan 10 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More