Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
Drop an image to update the jigsaw
css
:root { --animate: 0; --windowWidthScalar: 1; --windowHeightScalar: 1; --bg: #f3f0ed; --color: #9da2b9; } @media (prefers-color-scheme: dark) { :root { --bg: #242733; --color: #b6a491; } } body { margin: 0; height: 200vh; color: var(--color); background: var(--bg); } svg { position: fixed; width: 50vmin; height: 50vmin; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); overflow: visible !important; } path { fill: url(#puzzle); --startX: calc(var(--pieceX) * (100 * var(--windowWidthScalar) - 50) / 100 * 100%); --endX: 0px; --startY: calc(var(--pieceY) * (100 * var(--windowHeightScalar) - 50) / 100 * 100%); --endY: 0px; --startRotate: 0deg // set randomly below; --endRotate: 0deg; --x: calc(var(--startX) * (-1 * var(--animate) + 1) + var(--endX) * var(--animate)); --y: calc(var(--startY) * (-1 * var(--animate) + 1) + var(--endY) * var(--animate)); --rotate: calc(var(--startRotate) * (-1 * var(--animate) + 1) + var(--endRotate) * var(--animate)); -webkit-transform-origin: calc(50% + 50% * var(--pieceX)) calc(50% + 50% * var(--pieceY)); transform-origin: calc(50% + 50% * var(--pieceX)) calc(50% + 50% * var(--pieceY)); -webkit-transform: translate(var(--x), var(--y)) rotate(var(--rotate)); transform: translate(var(--x), var(--y)) rotate(var(--rotate)); stroke-width: 0.5vmin; stroke: var(--bg); } path:nth-of-type(n + 1) { --pieceX: -0.75; } path:nth-of-type(n + 5) { --pieceX: -0.25; } path:nth-of-type(n + 9) { --pieceX: 0.25; } path:nth-of-type(n + 13) { --pieceX: 0.75; } path:nth-of-type(4n + 1) { --pieceY: -0.75; } path:nth-of-type(4n + 2) { --pieceY: -0.25; } path:nth-of-type(4n + 3) { --pieceY: 0.25; } path:nth-of-type(4n + 4) { --pieceY: 0.75; } path:nth-of-type(1) { --startRotate: -51deg; } path:nth-of-type(2) { --startRotate: 52deg; } path:nth-of-type(3) { --startRotate: 83deg; } path:nth-of-type(4) { --startRotate: 75deg; } path:nth-of-type(5) { --startRotate: 75deg; } path:nth-of-type(6) { --startRotate: 85deg; } path:nth-of-type(7) { --startRotate: -65deg; } path:nth-of-type(8) { --startRotate: 63deg; } path:nth-of-type(9) { --startRotate: 88deg; } path:nth-of-type(10) { --startRotate: -56deg; } path:nth-of-type(11) { --startRotate: 90deg; } path:nth-of-type(12) { --startRotate: -61deg; } path:nth-of-type(13) { --startRotate: 54deg; } path:nth-of-type(14) { --startRotate: 88deg; } path:nth-of-type(15) { --startRotate: 91deg; } path:nth-of-type(16) { --startRotate: 95deg; } #upload { position: fixed; width: 100%; height: 100%; top: 0; left: 0; opacity: 0; z-index: 1; } #upload-mask { position: fixed; top: 1em; left: 1em; bottom: 1em; right: 1em; pointer-events: none; display: -webkit-box; display: flex; -webkit-box-pack: center; justify-content: center; -webkit-box-align: center; align-items: center; padding: 1em; border-radius: 0.5em; border: 0.1em dashed var(--color); text-align: center; font-size: 32px; color: var(--color); opacity: 0; z-index: 2; }
JavaScript
const root = document.documentElement; /* animation */ const setScroll = () => { root.style.setProperty("--animate", window.scrollY / window.innerHeight); }; setScroll(); window.addEventListener("scroll", setScroll); // debounce this in production /* page aspect ratio */ const setWindowSize = () => { const aspectRatio = window.innerWidth / window.innerHeight; root.style.setProperty( "--windowHeightScalar", aspectRatio > 1 ? 1 : 1 / aspectRatio ); root.style.setProperty( "--windowWidthScalar", aspectRatio < 1 ? 1 : aspectRatio ); }; setWindowSize(); window.addEventListener("resize", setWindowSize); // debounce this in production /* drag n drop */ const upload = document.getElementById("upload"); const uploadMask = document.getElementById("upload-mask"); upload.addEventListener("input", (e) => { uploadMask.style.opacity = 0; const input = e.target; if (input.files && input.files[0]) { const reader = new FileReader(); reader.onload = (readerE) => { document .getElementById("image") .setAttribute("xlink:href", readerE.target.result); }; reader.readAsDataURL(input.files[0]); } }); upload.addEventListener("dragenter", () => { uploadMask.style.opacity = 1; }); upload.addEventListener("dragleave", () => { uploadMask.style.opacity = 0; });
粒子
时间
文字
hover
canvas
3d
游戏
音乐
火焰
水波
轮播图
鼠标跟随
动画
css
加载动画
导航
菜单
按钮
滑块
tab
弹出层
统计图
svg
×
Close
在线代码下载提示
开通在线代码永久免费下载,需支付20jQ币
开通后,在线代码模块中所有代码可终身免费下!
您已开通在线代码永久免费下载,关闭提示框后,点下载代码可直接下载!
您已经开通过在线代码永久免费下载
对不起,您的jQ币不足!可通过发布资源 或
直接充值获取jQ币
取消
开通下载
<!doctype html> <html> <head> <meta charset="utf-8"> <title>SVG 拼图解算器-jq22.com</title> <script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script> <style>
</style> </head> <body>
<script>
</script>
</body> </html>
2012-2021 jQuery插件库版权所有
jquery插件
|
jq22工具库
|
网页技术
|
广告合作
|
在线反馈
|
版权声明
沪ICP备13043785号-1
浙公网安备 33041102000314号