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.
<!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: 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>
<!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