Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
0123456789
0123456789
:
0123456789
0123456789
:
0123456789
0123456789
css
@import url("https://fonts.googleapis.com/css?family=Oswald:700"); /* Recommended styles for Splitting */ .splitting .word, .splitting .char { display: inline-block; } /* Psuedo-element chars */ .splitting .char { position: relative; } /** * Populate the psuedo elements with the character to allow for expanded effects * Set to `display: none` by default; just add `display: block` when you want * to use the psuedo elements */ .splitting .char::before, .splitting .char::after { content: attr(data-char); position: absolute; top: 0; left: 0; visibility: hidden; transition: inherit; user-select: none; } /* Expanded CSS Variables */ .splitting { /* The center word index */ --word-center: calc((var(--word-total) - 1) / 2); /* The center character index */ --char-center: calc((var(--char-total) - 1) / 2); /* The center character index */ --line-center: calc((var(--line-total) - 1) / 2); } .splitting .word { /* Pecent (0-1) of the word's position */ --word-percent: calc(var(--word-index) / var(--word-total)); /* Pecent (0-1) of the line's position */ --line-percent: calc(var(--line-index) / var(--line-total)); } .splitting .char { /* Percent (0-1) of the char's position */ --char-percent: calc(var(--char-index) / var(--char-total)); /* Offset from center, positive & negative */ --char-offset: calc(var(--char-index) - var(--char-center)); /* Absolute distance from center, only positive */ --distance: calc( (var(--char-offset) * var(--char-offset)) / var(--char-center) ); /* Distance from center where -1 is the far left, 0 is center, 1 is far right */ --distance-sine: calc(var(--char-offset) / var(--char-center)); /* Distance from center where 1 is far left/far right, 0 is center */ --distance-percent: calc((var(--distance) / var(--char-center))); } html, body { background: #222; } html { height: 100%; display: -webkit-box; display: flex; } body { margin: auto; width: 100%; overflow: hidden; } .clock { --time-offset: 0; width: 100%; height: 100%; background: rgba(34, 34, 34, 0.8); text-align: center; display: -webkit-box; display: flex; -webkit-box-pack: center; justify-content: center; -webkit-box-align: center; align-items: center; height: 6em; color: #F1F1F1; font-family: monospace; font-size: 8vmin; font-family: 'Oswald', sans-serif; letter-spacing: 0.1em; -webkit-perspective: 500px; perspective: 500px; --h1: 1; --h2: 2; --m1: 3; --m2: 4; --s1: 5; --s2: 6; } .clock, .clock:before, .clock * { box-sizing: border-box; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; } .clock:before { content: ''; display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: -webkit-gradient(linear, left top, left bottom, color-stop(20%, rgba(34, 34, 34, 0.9)), color-stop(transparent), color-stop(transparent), color-stop(80%, rgba(34, 34, 34, 0.9))); background: linear-gradient(to bottom, rgba(34, 34, 34, 0.9) 20%, transparent calc(50% - .4ch), transparent calc(50% + .4ch), rgba(34, 34, 34, 0.9) 80%); -webkit-transform: translateZ(2.6em); transform: translateZ(2.6em); } .colon { display: inline-block; opacity: 0.8; -webkit-transform: translateZ(2.5em); transform: translateZ(2.5em); width: 1ch; margin: 0; text-align: center; } .cog { position: relative; width: 1ch; height: 1ch; margin: -.25ch .1ch 0; display: inline-block; -webkit-transition: -webkit-transform 0.3s cubic-bezier(0.4, 0, 0.6, 1); transition: -webkit-transform 0.3s cubic-bezier(0.4, 0, 0.6, 1); transition: transform 0.3s cubic-bezier(0.4, 0, 0.6, 1); transition: transform 0.3s cubic-bezier(0.4, 0, 0.6, 1), -webkit-transform 0.3s cubic-bezier(0.4, 0, 0.6, 1); -webkit-transform: rotateX(calc( -1turn * (var(--unit) / var(--char-total)) )); transform: rotateX(calc( -1turn * (var(--unit) / var(--char-total)) )); } .cog .word, .cog .char { position: absolute; top: 0%; left: 0%; width: 1ch; height: 1ch; } .cog .char { -webkit-transform: rotateX(calc( 4deg + (360deg * var(--char-percent) ))) translateZ(2.5em); transform: rotateX(calc( 4deg + (360deg * var(--char-percent) ))) translateZ(2.5em); } .tens { text-align: right; } .hours.tens { --unit: var(--h1); } .hours { --unit: var(--h2); } .minutes.tens { --unit: var(--m1); } .minutes { --unit: var(--m2); } .seconds.tens { --unit: var(--s1); } .seconds { --unit: var(--s2); }
JavaScript
console.clear(); Splitting(); var clock = document.querySelector('.clock'); /* We need zero-led values to help with the tens columns, and to allow for better looping around when reaching '9' */ function leadingZeroString(n){ return ('0' + n).slice(-2); } function updateTime(){ var d = new Date(); var h = leadingZeroString(d.getHours()); var m = leadingZeroString(d.getMinutes()); var s = leadingZeroString(d.getSeconds()); clock.style.setProperty('--h1', h[0]); clock.style.setProperty('--h2', h); clock.style.setProperty('--m1', m[0]); clock.style.setProperty('--m2', m); clock.style.setProperty('--s1', s[0]); clock.style.setProperty('--s2', s); } updateTime(); setInterval(updateTime, 1000);
粒子
时间
文字
hover
canvas
3d
游戏
音乐
火焰
水波
轮播图
鼠标跟随
动画
css
加载动画
导航
菜单
按钮
滑块
tab
弹出层
统计图
svg
×
Close
在线代码下载提示
开通在线代码永久免费下载,需支付20jQ币
开通后,在线代码模块中所有代码可终身免费下!
您已开通在线代码永久免费下载,关闭提示框后,点下载代码可直接下载!
您已经开通过在线代码永久免费下载
对不起,您的jQ币不足!可通过发布资源 或
直接充值获取jQ币
取消
开通下载
<!doctype html> <html> <head> <meta charset="utf-8"> <title>3D时钟-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号