社区文档构建进行中,欢迎编辑。社区答疑群(非官方):717421103,点点小课堂(腾讯会议):5696651544

全站通知:

Widget:签名

来自WIKI实验室WIKI_BWIKI_哔哩哔哩
跳到导航 跳到搜索

<style>#schale canvas { max-width: 100%; border: 1px solid; touch-action: none; }</style>

请在下面的框里签名

<button id="skip">跳过</button> <script> window.addEventListener("load",_ => { init() }) function init() { let sb = new SignBoard() sb.appendTo($("#schale")) sb.on("stop", e => { alert("签名结束") window.localStorage.schaleSign = JSON.stringify(sb.path) }) $("#skip").on("click", function () { if (sb.timer || sb.isSigned) { return } if (!window.localStorage.schaleSign) { alert("没有记录签名") return } let path = JSON.parse(window.localStorage.schaleSign) sb.isSigned = true rePath()

function rePath() { requestAnimationFrame(e => { let p = path.shift() if (p) { sb.draw(...p) rePath() } else { sb.stop() } }) } }) } </script>