Skip to content

Instantly share code, notes, and snippets.

@landongn
Created June 2, 2018 07:56
Show Gist options
  • Save landongn/27943dd4a4779d57a38df0da46b063ad to your computer and use it in GitHub Desktop.
Save landongn/27943dd4a4779d57a38df0da46b063ad to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Perspective</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="module">
import { html, render } from 'https://unpkg.com/lit-html/lib/lit-extended.js?module';
function lerp(v0, v1, t) {
return v0 * (1 - t) + v1 * t
}
let mouse = {x: 0, y: 0};
let positionDisplayTemplate = (data) => html`
<p>${data.x}</p>
<p>${data.y}</p>`;
const result = positionDisplayTemplate(mouse);
render(result, document.body);
window.addEventListener("mousemove", (e) => {
mouse.x = e.screenX;
mouse.y = e.screenY;
const result = positionDisplayTemplate(mouse);
render(result, document.body);
});
</script>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment