coherent-gameface-interaction-manager
Version:
Library for the most common UI interactions
39 lines (37 loc) • 1.11 kB
HTML
<html lang="en">
<head>
<style>
body {
width: 100vw;
height: 100vh;
margin: 0;
padding: 0;
background-color: white;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
.square {
width: 300px;
height: 300px;
background-color: orange;
}
</style>
</head>
<body>
<h1>Use two fingers to rotate the square</h1>
<div class="square"></div>
<script src="../../dist/touch-gestures.js"></script>
<script>
touchGestures.rotate({
element: document.body,
callback: function (angle) {
const square = document.querySelector('.square');
square.style.transform = `rotate(${angle}deg)`;
},
});
</script>
</body>
</html>