UNPKG

@egjs/axes

Version:

A module used to change the information of user action entered by various input devices such as touch screen or mouse into the logical virtual coordinates. You can easily create a UI that responds to user actions.

21 lines (17 loc) • 494 B
var roulette = document.getElementById("roulette"); var angleText = document.getElementById("angle-text"); var input = new eg.Axes.RotatePanInput("#area"); // create eg.Axes with option var axes = new eg.Axes({ angle: { range: [-720, 720] } }).on("change", function(e) { roulette.style.transform="rotate(" + e.pos.angle + "deg)"; angleText.textContent = e.pos.angle + "deg"; }); axes.connect("angle", input); axes.setTo({angle: 0}); setTimeout(() => { input.release(); }, 3000)