Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
css
:root { --color-grey: #2a2a21; --color-yellow: #edce4c; --color-bright-yellow: #ffe45e; --color-mustard: #dbbd3b; } body, html { display: flex; align-items: center; justify-content: center; width: 100vw; height: 100vh; overflow: hidden; background: linear-gradient(to bottom left, var(--color-bright-yellow), var(--color-mustard)); } .timer { box-shadow: 10px 10px 60px rgba(27, 27, 27, 0.9); display: grid; -webkit-column-gap: 1px; column-gap: 1px; row-gap: 1px; grid-template-columns: repeat(3, 100px); grid-template-rows: repeat(5, 100px); } .block { height: 100px; position: relative; transition: 400ms -webkit-transform ease; transition: 400ms transform ease; transition: 400ms transform ease, 400ms -webkit-transform ease; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; width: 100px; } .block > div { box-shadow: 0 0 30px rgba(0, 0, 0, 0.3) inset, 0 0 30px rgba(0, 0, 0, 0.3) inset; position: absolute; width: 100%; height: 100%; } .block .front, .block .back { background-color: var(--color-bright-yellow); } .block .top, .block .bottom { background-color: var(--color-grey); } .block .front { -webkit-transform: rotateY(0deg) translateZ(50px); transform: rotateY(0deg) translateZ(50px); } .block .top { -webkit-transform: rotateX(90deg) translateZ(50px); transform: rotateX(90deg) translateZ(50px); } .block .back { -webkit-transform: rotateY(180deg) translateZ(50px); transform: rotateY(180deg) translateZ(50px); } .block .bottom { -webkit-transform: rotateX(-90deg) translateZ(50px); transform: rotateX(-90deg) translateZ(50px); } .show-front { -webkit-transform: translateZ(-100px) rotateX(0deg); transform: translateZ(-100px) rotateX(0deg); } .show-top { -webkit-transform: translateZ(-100px) rotateX(-90deg); transform: translateZ(-100px) rotateX(-90deg); } .show-back { -webkit-transform: translateZ(-100px) rotateX(-180deg); transform: translateZ(-100px) rotateX(-180deg); } .show-bottom { -webkit-transform: translateZ(-100px) rotateX(-270deg); transform: translateZ(-100px) rotateX(-270deg); }
JavaScript
var timerEl = document.querySelector('.timer'); var blocksEl = timerEl.querySelectorAll('.block'); var zero = [0, 1, 2, 3, 5, 6, 8, 9, 11, 12, 13, 14]; var one = [1, 4, 7, 10, 13]; var two = [0, 1, 2, 5, 6, 7, 8, 9, 12, 13, 14]; var three = [0, 1, 2, 5, 6, 7, 8, 11, 12, 13, 14]; var four = [0, 2, 3, 5, 6, 7, 8, 11, 14]; var five = [0, 1, 2, 3, 6, 7, 8, 11, 12, 13, 14]; var six = [0, 3, 6, 7, 8, 9, 11, 12, 13, 14]; var seven = [0, 1, 2, 5, 8, 11, 14]; var eight = [0, 1, 2, 3, 5, 6, 7, 8, 9, 11, 12, 13, 14]; var nine = [0, 1, 2, 3, 5, 6, 7, 8, 11, 14]; var s = 0; var rotate = function rotate(el) { var rotation = el.dataset.rotate; var deg = rotation; if (s === 0) { deg = -90; } else { deg = deg - 90; } el.style.transform = 'translateZ(-100px) rotateX(' + deg + 'deg)'; el.dataset.rotate = deg; }; var getBlocks = function getBlocks(number, prevNum) { if (prevNum) { var dontRotate = prevNum.filter(function (val) {return number.includes(val);}); var doRotatePrev = prevNum.filter(function (val) {return !number.includes(val);}); var doRotateCurrent = number.filter(function (val) {return !dontRotate.includes(val);}); doRotateCurrent.forEach(function (block) { rotate(blocksEl[block]); }); doRotatePrev.forEach(function (block) { rotate(blocksEl[block]); }); } else { number.forEach(function (block) { rotate(blocksEl[block]); }); } }; var timer = function timer() { window.setInterval(function () { if (s === 1) { getBlocks(one, zero); } if (s === 2) { getBlocks(two, one); } if (s === 3) { getBlocks(three, two); } if (s === 4) { getBlocks(four, three); } if (s === 5) { getBlocks(five, four); } if (s === 6) { getBlocks(six, five); } if (s === 7) { getBlocks(seven, six); } if (s === 8) { getBlocks(eight, seven); } if (s === 9) { getBlocks(nine, eight); } if (s === 10) { getBlocks(zero, nine); s = 0; } s += 1; }, 1000); }; timer();
粒子
时间
文字
hover
canvas
3d
游戏
音乐
火焰
水波
轮播图
鼠标跟随
动画
css
加载动画
导航
菜单
按钮
滑块
tab
弹出层
统计图
svg
×
Close
在线代码下载提示
开通在线代码永久免费下载,需支付20jQ币
开通后,在线代码模块中所有代码可终身免费下!
您已开通在线代码永久免费下载,关闭提示框后,点下载代码可直接下载!
您已经开通过在线代码永久免费下载
对不起,您的jQ币不足!可通过发布资源 或
直接充值获取jQ币
取消
开通下载
<!doctype html> <html> <head> <meta charset="utf-8"> <title>时间代码-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号