Last active
August 29, 2015 14:05
-
-
Save JScott/06157326c997500a91b8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<script> | |
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() { | |
post.send(document.getElementsByTagName("mvml")[0].innerHTML); | |
} | |
</script> | |
</head> | |
<mvml> | |
--- | |
title: JavaScript test | |
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 | |
position: (5, 0, 0) | |
- primitive: box | |
position: (0, 0, -20) | |
scale: (30,10,1) | |
color: 0x00ff00 | |
- primitive: box | |
position: (-5, 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) | |
color: green | |
</mvml> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 a separate file. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<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.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(); | |
} | |
</script> | |
</head> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment