sciabarra
4/24/2016 - 3:51 PM

README.md

Install your stuff with

bower install davinci jquery

Copy the gist in the bower_components as index.html Run an http server like python -m SimpleHTTPServer

Grab an example from github.com/geometryzen/demos/ For example:

https://raw.githubusercontent.com/geometryzen/demos/master/Canvas-3D/Cameras/OrthographicCamera.py

Load and Run and you are ready.

PS some examples are not working probably for a version conflict of Three.js

<html>
  <head>
    <script src="/threejs/build/three.min.js"></script>
    <script src="/EaselJS/lib/easeljs-0.8.0.min.js"></script>
    <script src="/TweenJS/lib/tweenjs-0.6.0.min.js"></script>
    <script src="/davinci/davinci.min.js"></script>
    <script src="/bladejs/dist/bladejs.min.js"></script>
    <script src="/davinci/davinci-stdlib.js"></script>
    <script src="/jquery/dist/jquery.min.js"></script>
 </head> 
  <body> 
    <h3>Geometry Zen DaVinci library (standalone)</h3> 
    <script>
function outf(text)
{
  var mypre = document.getElementById("output");
  mypre.innerHTML = mypre.innerHTML + text;
}
function builtinRead(x)
{
  if (Sk.builtinFiles === undefined || Sk.builtinFiles["files"][x] === undefined)
  {
    throw "File not found: '" + x + "'";
  }
  return Sk.builtinFiles["files"][x];
}
function run() {
  var program = document.getElementById("program").value;
  var mypre = document.getElementById("output");
  mypre.innerHTML = '';
  Sk.configure({"output": outf, "read": builtinRead});
  eval(Sk.importMainWithBody("<stdin>", false, program));
}
function load() {
  $.get($("#url").val(), function(data) { 
    $("#program").text(data)
  } )
}
    </script>

    <!-- Change the style from inline to none if you want to hide the code. -->
    <textarea id="program" cols="80" rows="20" style="display:inline;">
    </textarea>
    <br/>
    URL: <input type="text" size="40" id="url">
    <button type="button" onclick="load()">Load</button>
    <button type="button" onclick="run()">Run</button>
    <pre id="output"></pre>
    <canvas id="mycanvas" width="640" height="360"></mycanvas>
  </body>
</html>