Skip to content

Commit

Permalink
temp save
Browse files Browse the repository at this point in the history
Signed-off-by: hanbollar <github@hannahbollar.com>
  • Loading branch information
hanbollar committed May 13, 2024
1 parent fe07149 commit 2099ebd
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 246 deletions.
4 changes: 2 additions & 2 deletions dist/mr.js

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"type": "module",
"description": "an MR first webXR framework",
"engines": {
"node": ">=20.0.0",
"npm": ">=6.14.4"
"node": "^18.17.0 || >=20.5.0"
},
"main": "dist/mr.js",
"homepage": "https://mrjs.io",
Expand Down Expand Up @@ -35,9 +34,6 @@
"bugs": {
"url": "https://github.com/Volumetrics-io/mrjs/issues"
},
"engines": {
"node": "^18.17.0 || >=20.5.0"
},
"testMatch": [
"**/__tests__/**/*.test.mjs"
],
Expand Down Expand Up @@ -87,6 +83,7 @@
"jsdom": "^24.0.0",
"prettier": "^3.2.4",
"prettier-eslint-cli": "^8.0.1",
"spectorjs": "^0.9.30",
"stats.js": "^0.17.0",
"three": "^0.161.0",
"troika-three-text": "^0.48.1"
Expand Down
290 changes: 52 additions & 238 deletions samples/index.html
Original file line number Diff line number Diff line change
@@ -1,257 +1,71 @@
<!-- THIS IS AUTO GENERATED FROM scripts/update-all-submodules.sh ANY DIRECT EDITS WILL NOT BE SAVED -->
<!DOCTYPE html>
<html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" prefix="og: http://ogp.me/ns#">

<head>
<meta charset="utf-8">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Volumetrics — Your Spatial developement companion</title>
<link rel="shortcut icon" href="/favicon.ico" />
<!-- <script src="https://cdn.jsdelivr.net/gh/volumetrics-io/mrjs/dist/mr.js"></script> -->
<script src="./mr.js"></script>
<style>
* {
padding: 0;
margin: 0;
border: none;
box-sizing: border-box;
}

<!-- Title -->
<title>MRjs</title>

<!-- Favicon -->
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />

<!-- SEO -->
<meta name="description" content="An extensible library of Web Components for the spatial web." />

<!-- Basic Open Graph -->
<meta content="MRjs" itemProp="name" class="next-head" />
<meta content="An extensible library of Web Components for the spatial web." itemProp="description" class="next-head" />
<meta content="https://mrjs.io/opengraph.jpg" itemProp="image" class="next-head" />

<!-- Generic Open Graph -->
<meta property="og:type" content="article" class="next-head" />
<meta content="MRjs" property="og:title" class="next-head" />
<meta content="https://mrjs.io" property="og:url" class="next-head" />
<meta content="https://mrjs.io/opengraph.jpg" property="og:image" class="next-head" />
<meta content="An extensible library of Web Components for the spatial web." property="og:description"
class="next-head" />
<meta content="MRjs" property="og:site_name" class="next-head" />

<!-- CSS Styles -->
<link rel="stylesheet" type="text/css" href="index-style.css"/>
mr-app {
width: 100vw;
height: 100vh;
border-radius: unset;
background-color: transparent;
}

<!-- MRjs -->
<script src="./mr.js"></script>
#logo {
width: 300px;
height: 300px;
z-index: 70;
scale: 3.5;
}
</style>

</head>

<body>
<!-- <mr-app debug="true"> -->
<mr-app>
<mr-light color="white" intensity="2" data-position="0 0.5 0.5"></mr-light>
<mr-light id="mouselight" color="white" intensity="0.25" data-position="0 0 0.5"></mr-light>

<mr-panel>
<mr-div class="gapped padded section">
<mr-model style="height: 100px; width: 220px; scale: 0.07; z-index: 10;"
src="./index-assets/mrjs_logo_large.glb"></mr-model>
<mr-text class="h1">An extensible library of Web Components for the spatial web.</mr-text>
<mr-text class="chapeau">MRjs is a mixed-reality-first, WebXR interface library meant to bootstrap
spatial web app development. It implements much of the foundational work so that developers can
spend less time on the basics and more time on their app.</mr-text>
<mr-a target="_blank" href="https://github.com/Volumetrics-io/mrjs">See on GitHub</mr-a>
<mr-a target="_blank" href="https://discord.gg/volumetrics">Join us on Discord</mr-a>
<mr-button class="documentation" onclick="redirectToDocumentation()">Documentation</mr-button>
</mr-div>

<mr-div class="triptych">
<mr-div class="gapped padded section">
<mr-model id="extendable" data-position="0.01 0.01 5"
style="height: 120px; width: 140px; scale: 2.7; z-index: 50 ;"
src="./index-assets/jigsaw.glb"></mr-model>
<mr-text class="h2">Extensible</mr-text>
<mr-text class="narrow">Being open-source and built on top of web standards, you can easily
implement custom elements and contribute to the ecosystem.</mr-text>
</mr-div>
<mr-div class="gapped padded section">
<mr-model id="familiar" data-position="0 0 5"
style="height: 120px; width: 140px; scale: 1.7; z-index: 50 ;"
src="./index-assets/familiar.glb"></mr-model>
<mr-text class="h2">Familiar</mr-text>
<mr-text class="narrow">Looks and feels like native HTML and CSS, but designed from the ground up
for mixed-reality. Start with 2D and ease your way into creating 3D content.</mr-text>
</mr-div>
<mr-div class="gapped padded section">
<mr-model id="all-in-one" data-position="0 0 0"
style="height: 120px; width: 140px; scale: 1.7; z-index: 30;"
src="./index-assets/all-in-one.glb"></mr-model>
<mr-text class="h2">All-in-one</mr-text>
<mr-text class="narrow">Asset management, physics, and user interaction come built in, so you can
spend less time laying the foundation and more time building your app.</mr-text>
</mr-div>
</mr-div>

<!-- <mr-div class="diptych">
<mr-div class="gapped padded section">
<mr-text class="h2">Open-source and extendable</mr-text>
<mr-text class="narrow">Built on top of web standards, you can implement custom elements and
contribute to the ecosystem.</mr-text>
</mr-div>
<mr-div class="section">
<mr-div class="illustration">
<mr-model style="scale: 0.03; z-index: 20" src="./index-assets/koifish.glb"
data-comp-animation="clip: 0; action: play;"></mr-model>
</mr-div>
</mr-div>
</mr-div>
<mr-div class="diptych">
<mr-div class="section">
<mr-div class="illustration">
<mr-model style="scale: 0.03; z-index: 20" src="./index-assets/koifish.glb"
data-comp-animation="clip: 0; action: play;"></mr-model>
</mr-div>
</mr-div>
<mr-div class="gapped padded section first">
<mr-text class="h2">Familiar and powerful</mr-text>
<mr-text class="narrow">Looks and feels like existing libraries, but designed from the ground up for
mixed-reality. Start with 2D and ease your way into creating 3D content.</mr-text>
</mr-div>
</mr-div>
<mr-div class="diptych">
<mr-div class="gapped padded section">
<mr-text class="h2">All-in-one</mr-text>
<mr-text class="narrow">Asset management, physics, and user interaction come built in, so you can
spend less time laying the foundation and more time building your app.</mr-text>
</mr-div>
<mr-div class="section">
<mr-div class="illustration">
<mr-model style="scale: 0.03; z-index: 20" src="./index-assets/koifish.glb"
data-comp-animation="clip: 0; action: play;"></mr-model>
</mr-div>
</mr-div>
</mr-div> -->

<mr-div class="gapped padded section">
<mr-text class="h1">Examples</mr-text>

<mr-div class="mosaic">

<mr-div class="illustration">
<mr-a target="_blank" class="example-link"
href="/examples/anchors.html">Anchoring</mr-a>
</mr-div>

<mr-div class="illustration">
<mr-a target="_blank" class="example-link"
href="/examples/audio.html">Audio</mr-a>
</mr-div>

<mr-div class="illustration">
<mr-a target="_blank" class="example-link"
href="/examples/camera.html">Camera</mr-a>
</mr-div>

<mr-div class="illustration">
<mr-a target="_blank" class="example-link"
href="/examples/debug.html">Debugging</mr-a>
</mr-div>

<mr-div class="illustration">
<mr-a target="_blank" class="example-link"
href="/examples/embed.html">Embed</mr-a>
</mr-div>

<mr-div class="illustration">
<mr-a target="_blank" class="example-link"
href="/examples/images.html">Images</mr-a>
</mr-div>

<mr-div class="illustration">
<mr-a target="_blank" class="example-link"
href="/examples/models.html">Models</mr-a>
</mr-div>

<mr-div class="illustration">
<mr-a target="_blank" class="example-link"
href="/examples/skybox.html">Skybox</mr-a>
</mr-div>

<mr-div class="illustration">
<mr-a target="_blank" class="example-link"
href="/examples/video.html">Video</mr-a>
</mr-div>

</mr-div>
</mr-div>



</mr-panel>
<mr-app debug="true">
<mr-light color="hsl(340, 100%, 50%)" intensity="5" data-position="-0.3 0.5 0.2"></mr-light>
<mr-light color="hsl(180, 100%, 50%)" intensity="2.5" data-position="0 -0.5 0.4"></mr-light>
<mr-light color="hsl(40, 100%, 50%)" intensity="5" data-position="0.6 0.25 0.2"></mr-light>
<mr-model id="logo" src="./examples-assets/models/logo.glb"></mr-model>
</mr-app>

<script>

function redirectToDocumentation() {
window.location.href = "https://docs.mrjs.io";
}

window.requestAnimationFrame(function rotate_extendable(timestamp) {
let rx = Math.cos(timestamp / 2000) * 5 + 50;
let ry = Math.cos(timestamp / 2000) * 5 - 40;
let rz = Math.sin(timestamp / 2000) * 5;
document.querySelector("#extendable").dataset.rotation = rx + " " + ry + " " + rz;
window.requestAnimationFrame(rotate_extendable);
});

window.requestAnimationFrame(function rotate_familiar(timestamp) {
let rx = Math.cos(timestamp / 2000) * 10 + 25;
let ry = Math.cos(timestamp / 2000) * 10 + 230;
let rz = Math.sin(timestamp / 2000) * 10 + 5;
document.querySelector("#familiar").dataset.rotation = rx + " " + ry + " " + rz;
window.requestAnimationFrame(rotate_familiar);
});

window.requestAnimationFrame(function rotate_allInOne(timestamp) {
let rx = Math.cos(timestamp / 2000) * -10 + 25;
let ry = Math.cos(timestamp / 2000) * -10 + 50;
let rz = Math.sin(timestamp / 2000) * -10 + 5;
document.querySelector("#all-in-one").dataset.rotation = rx + " " + ry + " " + rz;
window.requestAnimationFrame(rotate_allInOne);
});


// Light follow mouse
(function () {
"use strict";

document.onmousemove = handleMouseMove;
function handleMouseMove(event) {
var dot, eventDoc, doc, body, pageX, pageY;

event = event || window.event; // IE-ism

// If pageX/Y aren't available and clientX/Y
// are, calculate pageX/Y - logic taken from jQuery
// Calculate pageX/Y if missing and clientX/Y available
if (event.pageX == null && event.clientX != null) {
eventDoc = (event.target && event.target.ownerDocument) || document;
doc = eventDoc.documentElement;
body = eventDoc.body;

event.pageX =
event.clientX +
((doc && doc.scrollLeft) || (body && body.scrollLeft) || 0) -
((doc && doc.clientLeft) || (body && body.clientLeft) || 0);
event.pageY =
event.clientY +
((doc && doc.scrollTop) || (body && body.scrollTop) || 0) -
((doc && doc.clientTop) || (body && body.clientTop) || 0);
}

let ratioX = (event.pageX * 2) / window.innerWidth - 1;
let ratioY = -((event.pageY * 2) / window.innerHeight - 1);

document.querySelector("#mouselight").dataset.position =
ratioX + " " + ratioY + " 0.25";
function rotate(timestamp) {
t = timestamp / 200;
let rx = (-t) % -360;
let ry = (t) % 360;
let rz = (t * 2) % 360;
document.querySelector("#logo").dataset.rotation = rx + " " + ry + " " + rz;

let data = {
rx: Math.round(rx * 100) / 100,
ry: Math.round(ry * 100) / 100,
rz: Math.round(rz * 100) / 100
}
})();
window.top.postMessage(JSON.stringify(data), '*')
window.requestAnimationFrame(rotate);
};
window.requestAnimationFrame(rotate);

// window.onload = () => {
// document.querySelector("#logo").onclick = () => {
// console.log("clicked");
// }
// }

</script>
</body>

</html>
<!-- THIS IS AUTO GENERATED FROM scripts/update-all-submodules.sh ANY DIRECT EDITS WILL NOT BE SAVED -->
Loading

0 comments on commit 2099ebd

Please sign in to comment.