Skip to content

Instantly share code, notes, and snippets.

@JScott
Last active August 29, 2015 14:05
Show Gist options
  • Select an option

  • Save JScott/06157326c997500a91b8 to your computer and use it in GitHub Desktop.

Select an option

Save JScott/06157326c997500a91b8 to your computer and use it in GitHub Desktop.

Revisions

  1. JScott renamed this gist Aug 18, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. JScott revised this gist Aug 18, 2014. 3 changed files with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion MVML-JS-API
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,3 @@
    These files show example pages that use the hosted MVML API with HTML5 and JS.
    Just copy these files onto your page and let the API handle the rest.
    You can either edit the MVML in-line or as another hosted file.
    You can either edit the MVML in-line or as a separate file.
    File renamed without changes.
    File renamed without changes.
  3. JScott revised this gist Aug 18, 2014. 3 changed files with 6 additions and 4 deletions.
    3 changes: 3 additions & 0 deletions MVML-JS-API
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    These files show example pages that use the hosted MVML API with HTML5 and JS.
    Just copy these files onto your page and let the API handle the rest.
    You can either edit the MVML in-line or as another hosted file.
    7 changes: 3 additions & 4 deletions mvml-api-js2.html → js-and-html.html
    Original file line number Diff line number Diff line change
    @@ -20,7 +20,7 @@
    </head>
    <mvml>
    ---
    title: Hello metaverse!
    title: JavaScript test
    player:
    move_speed: 15
    turn_speed: 1.5
    @@ -30,15 +30,15 @@
    gravity: 30
    scene:
    - primitive: sphere
    position: (5, 0, 0)

    - primitive: box
    position: (0, 0, -20)
    scale: (30,10,1)
    mass: 0
    color: 0x00ff00

    - primitive: box
    position: (-10, 1, 0)
    position: (-5, 1, 0)
    scale: (2,2,4)
    rotation: (0,-30,0)
    color: 0x00ffff
    @@ -48,7 +48,6 @@
    position: (0,-2, 0)
    scale: (200,200,1)
    rotation: (-90,0,0)
    mass: 0
    color: green
    </mvml>
    </html>
    File renamed without changes.
  4. JScott revised this gist Aug 18, 2014. 2 changed files with 0 additions and 0 deletions.
    File renamed without changes.
    File renamed without changes.
  5. JScott revised this gist Aug 18, 2014. 2 changed files with 0 additions and 0 deletions.
    File renamed without changes.
    File renamed without changes.
  6. JScott revised this gist Aug 18, 2014. 2 changed files with 49 additions and 49 deletions.
    49 changes: 12 additions & 37 deletions 1-js.html
    Original file line number Diff line number Diff line change
    @@ -2,53 +2,28 @@
    <html lang="en">
    <head>
    <script>
    var mvml_file_url = "http://dev.mvml.net/mvml/spec.mvml";
    var api_url = "http://direct.dev.mvml.net:6865/";


    var get = new XMLHttpRequest();
    get.open("GET", mvml_file_url, true);
    var post = new XMLHttpRequest();
    post.open("POST", url, true);
    post.open("POST", api_url, true);
    post.setRequestHeader("Content-Type", "text/mvml");
    post.onreadystatechange = function() {
    if(post.readyState == 4 && post.status == 200) {
    document.write(post.responseText);
    document.close();
    }
    }
    get.onreadystatechange = function() {
    if(get.readyState == 4 && get.status == 200) {
    post.send(get.responseText);
    }
    }
    window.onload = function() {
    post.send(document.getElementsByTagName("mvml")[0].innerHTML);
    get.send();
    }
    </script>
    </head>
    <mvml>
    ---
    title: Hello metaverse!
    player:
    move_speed: 15
    turn_speed: 1.5
    min_jump_speed: 0
    max_jump_speed: 20
    start: (0,0,30)
    gravity: 30
    scene:
    - primitive: sphere

    - primitive: box
    position: (0, 0, -20)
    scale: (30,10,1)
    mass: 0
    color: 0x00ff00

    - primitive: box
    position: (-10, 1, 0)
    scale: (2,2,4)
    rotation: (0,-30,0)
    color: 0x00ffff
    physics: off

    - primitive: plane
    position: (0,-2, 0)
    scale: (200,200,1)
    rotation: (-90,0,0)
    mass: 0
    color: green
    </mvml>
    </html>
    </html>
    49 changes: 37 additions & 12 deletions 2-html-and-js.html
    Original file line number Diff line number Diff line change
    @@ -2,28 +2,53 @@
    <html lang="en">
    <head>
    <script>
    var mvml_file_url = "http://dev.mvml.net/mvml/spec.mvml";
    var api_url = "http://direct.dev.mvml.net:6865/";

    var get = new XMLHttpRequest();
    get.open("GET", mvml_file_url, true);

    var post = new XMLHttpRequest();
    post.open("POST", api_url, true);
    post.open("POST", url, true);
    post.setRequestHeader("Content-Type", "text/mvml");
    post.onreadystatechange = function() {
    if(post.readyState == 4 && post.status == 200) {
    document.write(post.responseText);
    document.close();
    }
    }
    get.onreadystatechange = function() {
    if(get.readyState == 4 && get.status == 200) {
    post.send(get.responseText);
    }
    }
    window.onload = function() {
    get.send();
    post.send(document.getElementsByTagName("mvml")[0].innerHTML);
    }
    </script>
    </head>
    </html>
    <mvml>
    ---
    title: Hello metaverse!
    player:
    move_speed: 15
    turn_speed: 1.5
    min_jump_speed: 0
    max_jump_speed: 20
    start: (0,0,30)
    gravity: 30
    scene:
    - primitive: sphere

    - primitive: box
    position: (0, 0, -20)
    scale: (30,10,1)
    mass: 0
    color: 0x00ff00

    - primitive: box
    position: (-10, 1, 0)
    scale: (2,2,4)
    rotation: (0,-30,0)
    color: 0x00ffff
    physics: off

    - primitive: plane
    position: (0,-2, 0)
    scale: (200,200,1)
    rotation: (-90,0,0)
    mass: 0
    color: green
    </mvml>
    </html>
  7. JScott revised this gist Aug 18, 2014. 2 changed files with 0 additions and 0 deletions.
    File renamed without changes.
    File renamed without changes.
  8. JScott revised this gist Aug 18, 2014. 2 changed files with 0 additions and 0 deletions.
    File renamed without changes.
    File renamed without changes.
  9. JScott revised this gist Aug 18, 2014. No changes.
  10. JScott revised this gist Aug 18, 2014. 2 changed files with 14 additions and 10 deletions.
    17 changes: 9 additions & 8 deletions js-and-html.html
    Original file line number Diff line number Diff line change
    @@ -2,18 +2,19 @@
    <html lang="en">
    <head>
    <script>
    var http = new XMLHttpRequest();
    var url = "http://direct.dev.mvml.net:6865/";
    http.open("POST", url, true);
    http.setRequestHeader("Content-Type", "text/mvml");
    http.onreadystatechange = function() {
    if(http.readyState == 4 && http.status == 200) {
    document.write(http.responseText);
    var api_url = "http://direct.dev.mvml.net:6865/";

    var post = new XMLHttpRequest();
    post.open("POST", url, true);
    post.setRequestHeader("Content-Type", "text/mvml");
    post.onreadystatechange = function() {
    if(post.readyState == 4 && post.status == 200) {
    document.write(post.responseText);
    document.close();
    }
    }
    window.onload = function() {
    http.send(document.getElementsByTagName("mvml")[0].innerHTML);
    post.send(document.getElementsByTagName("mvml")[0].innerHTML);
    }
    </script>
    </head>
    7 changes: 5 additions & 2 deletions just-js.html
    Original file line number Diff line number Diff line change
    @@ -2,10 +2,13 @@
    <html lang="en">
    <head>
    <script>
    var mvml_file_url = "http://dev.mvml.net/mvml/spec.mvml";
    var api_url = "http://direct.dev.mvml.net:6865/";

    var get = new XMLHttpRequest();
    get.open("GET", "http://dev.mvml.net/mvml/spec.mvml", true);
    get.open("GET", mvml_file_url, true);
    var post = new XMLHttpRequest();
    post.open("POST", "http://direct.dev.mvml.net:6865/", true);
    post.open("POST", api_url, true);
    post.setRequestHeader("Content-Type", "text/mvml");
    post.onreadystatechange = function() {
    if(post.readyState == 4 && post.status == 200) {
  11. JScott revised this gist Aug 18, 2014. 2 changed files with 0 additions and 2 deletions.
    File renamed without changes.
    2 changes: 0 additions & 2 deletions api-js → just-js.html
    Original file line number Diff line number Diff line change
    @@ -23,6 +23,4 @@
    }
    </script>
    </head>


    </html>
  12. JScott revised this gist Aug 18, 2014. 2 changed files with 68 additions and 41 deletions.
    56 changes: 15 additions & 41 deletions api-js
    Original file line number Diff line number Diff line change
    @@ -2,53 +2,27 @@
    <html lang="en">
    <head>
    <script>
    var http = new XMLHttpRequest();
    var url = "http://direct.dev.mvml.net:6865/";
    http.open("POST", url, true);
    http.setRequestHeader("Content-Type", "text/mvml");

    http.onreadystatechange = function() {
    if(http.readyState == 4 && http.status == 200) {
    document.write(http.responseText);
    var get = new XMLHttpRequest();
    get.open("GET", "http://dev.mvml.net/mvml/spec.mvml", true);
    var post = new XMLHttpRequest();
    post.open("POST", "http://direct.dev.mvml.net:6865/", true);
    post.setRequestHeader("Content-Type", "text/mvml");
    post.onreadystatechange = function() {
    if(post.readyState == 4 && post.status == 200) {
    document.write(post.responseText);
    document.close();
    }
    }
    get.onreadystatechange = function() {
    if(get.readyState == 4 && get.status == 200) {
    post.send(get.responseText);
    }
    }
    window.onload = function() {
    http.send(document.getElementsByTagName("mvml")[0].innerHTML);
    get.send();
    }
    </script>
    </head>
    <mvml>
    ---
    title: Hello metaverse!
    player:
    move_speed: 15
    turn_speed: 1.5
    min_jump_speed: 0
    max_jump_speed: 20
    start: (0,0,30)
    gravity: 30
    scene:
    - primitive: sphere

    - primitive: box
    position: (0, 0, -20)
    scale: (30,10,1)
    mass: 0
    color: 0x00ff00

    - primitive: box
    position: (-10, 1, 0)
    scale: (2,2,4)
    rotation: (0,-30,0)
    color: 0x00ffff
    physics: off

    - primitive: plane
    position: (0,-2, 0)
    scale: (200,200,1)
    rotation: (-90,0,0)
    mass: 0
    color: green
    </mvml>
    </html>
    </html>
    53 changes: 53 additions & 0 deletions api-js-html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,53 @@
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <script>
    var http = new XMLHttpRequest();
    var url = "http://direct.dev.mvml.net:6865/";
    http.open("POST", url, true);
    http.setRequestHeader("Content-Type", "text/mvml");
    http.onreadystatechange = function() {
    if(http.readyState == 4 && http.status == 200) {
    document.write(http.responseText);
    document.close();
    }
    }
    window.onload = function() {
    http.send(document.getElementsByTagName("mvml")[0].innerHTML);
    }
    </script>
    </head>
    <mvml>
    ---
    title: Hello metaverse!
    player:
    move_speed: 15
    turn_speed: 1.5
    min_jump_speed: 0
    max_jump_speed: 20
    start: (0,0,30)
    gravity: 30
    scene:
    - primitive: sphere

    - primitive: box
    position: (0, 0, -20)
    scale: (30,10,1)
    mass: 0
    color: 0x00ff00

    - primitive: box
    position: (-10, 1, 0)
    scale: (2,2,4)
    rotation: (0,-30,0)
    color: 0x00ffff
    physics: off

    - primitive: plane
    position: (0,-2, 0)
    scale: (200,200,1)
    rotation: (-90,0,0)
    mass: 0
    color: green
    </mvml>
    </html>
  13. JScott created this gist Aug 18, 2014.
    54 changes: 54 additions & 0 deletions api-js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,54 @@
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <script>
    var http = new XMLHttpRequest();
    var url = "http://direct.dev.mvml.net:6865/";
    http.open("POST", url, true);
    http.setRequestHeader("Content-Type", "text/mvml");

    http.onreadystatechange = function() {
    if(http.readyState == 4 && http.status == 200) {
    document.write(http.responseText);
    document.close();
    }
    }
    window.onload = function() {
    http.send(document.getElementsByTagName("mvml")[0].innerHTML);
    }
    </script>
    </head>
    <mvml>
    ---
    title: Hello metaverse!
    player:
    move_speed: 15
    turn_speed: 1.5
    min_jump_speed: 0
    max_jump_speed: 20
    start: (0,0,30)
    gravity: 30
    scene:
    - primitive: sphere

    - primitive: box
    position: (0, 0, -20)
    scale: (30,10,1)
    mass: 0
    color: 0x00ff00

    - primitive: box
    position: (-10, 1, 0)
    scale: (2,2,4)
    rotation: (0,-30,0)
    color: 0x00ffff
    physics: off

    - primitive: plane
    position: (0,-2, 0)
    scale: (200,200,1)
    rotation: (-90,0,0)
    mass: 0
    color: green
    </mvml>
    </html>