Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
显示精灵
1
动画持续时间
css
/* -------------- Animation -------------- */ #animation { display: inline-block; position: relative; text-align: center; } /* -------------- Frame -------------- */ .showRoll #frame { border-color: hsl(0,0%,70%); } #frame { width: 50px; height: 72px; border: 1px solid transparent; background: url(https://s.cdpn.io/79/sprite-steps.png) no-repeat left top; animation: frame-animation 1s steps(10) infinite; } @keyframes frame-animation { 0% { background-position: 0px 0; } 100% { background-position: -500px 0; } } /* -------------- Roll -------------- */ .showRoll #roll { opacity: .2; } #roll { opacity: 0; position: absolute; z-index: -1; top: 0; left: 0; width: 500px; height: 72px; border: 1px solid hsl(0,0%,70%); background: hsl(0,0%,100%) url(https://s.cdpn.io/79/sprite-steps.png) no-repeat left top; transition: opacity .3s linear; animation: roll-animation 1s steps(10) infinite; } @keyframes roll-animation { 0% { transform: translateX(0); } 100% { transform: translateX(-500px); } } /* Global ------------------------------------------------------ */ html { height: 100%; font:62.5%/1 "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; background: #f0f0f0 url(../img/bg.png); } body { display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; width: 100%; height: 100%; padding: 50px; -moz-box-sizing: border-box; box-sizing: border-box; text-align: center; overflow: hidden; text-align: center; } a { text-decoration: none; color: hsl(210,100%,60%); } a:hover { color: hsl(210,100%,70%); } a:active { color: hsl(210,100%,50%); } p { font-size: 11px; line-height: 1.5; color: hsl(0,0%,60%); } .hl { color: hsl(0,0%,20%); } ul { margin: 40px 0; list-style: none; text-align: center; font-size: 14px; color: hsl(0,0%,60%); } .WebKit ul { text-align: left; } li { padding: 5px 0; } /* Show Sprite Checkbox ------------------------------------------------------ */ .WebKit #show { -webkit-appearance: none; outline: none; border-radius: 20px; width: 20px; height: 20px; margin: -2px 6px 0 0; vertical-align: middle; border: 10px solid hsl(0,0%,80%); background: hsl(0,0%,40%); box-shadow: 0 1px 0 hsla(0,0%,100%,.6); -webkit-transition: border-width .2s cubic-bezier(.26, .08, .15, 1); } .WebKit #show:checked:active, .WebKit #show:active { border: 0px solid hsl(0,0%,80%); -webkit-transition-duration: .1; } .WebKit #show:checked { border: 5px solid hsl(0,0%,80%); box-shadow: inset 0 1px 2px hsla(0,0%,0%,.4), 0 1px 0 hsla(0,0%,100%,.6); } /* Animation Duration ------------------------------------------------------ */ #duration { display: inline-block; position: relative; margin: -4px 6px 0 0; } /* Label */ #duration-label { display: none; } .WebKit #duration-label { position: absolute; display: block; z-index: 1; top: 6px; font-size: 11px; color: hsl(0,0%,60%); text-shadow: 0 1px 0 hsla(0,0%,100%,.3); pointer-events: none; -webkit-transition: -webkit-transform .2s cubic-bezier(.26, .08, .15, 1), color .6s .2s ease-out; } .WebKit #duration-label.isRight { right: 50%; margin-right: -20px; left: auto; -webkit-transform: translate3d(20px,0,0); } .WebKit #duration-label.isLeft { right: auto; margin-left: -20px; left: 50%; -webkit-transform: translate3d(-20px,0,0); } .WebKit #duration:active #duration-label { color: hsl(0,0%,30%); -webkit-transition-delay: 0; } /* Input */ .WebKit #duration-input { -webkit-appearance: none; position: relative; vertical-align: middle; width: 100px; border-radius: 20px; background: hsl(0,0%,80%); box-shadow: 0 1px 0 hsla(0,0%,100%,.6); overflow: hidden; outline: none; } .WebKit #duration-input::-webkit-slider-thumb { -webkit-appearance: none; border-radius: 20px; width: 20px; height: 20px; border: 5px solid hsl(0,0%,80%); background: hsl(0,0%,40%); box-shadow: inset 0 1px 2px hsla(0,0%,0%,.4); -webkit-transition: border-width .2s cubic-bezier(.26, .08, .15, 1); } .WebKit #duration-input:active::-webkit-slider-thumb { border: 0px solid hsl(0,0%,80%); -webkit-transition-duration: .1; }
JavaScript
if ($.browser.webkit) { // yeah, sorry.. but this demo uses appearance:none which hasn't good support anywhere else. $('html').addClass('WebKit'); } $('#show').change( function() { $('#animation').toggleClass('showRoll'); }); var labelSide = "right"; $('#duration-input').change( function() { var val = $(this).val(); var valRounded = Math.round( val * 10 ) / 10; var mid = $(this).attr('max')/2; $('#frame').css("animation-duration", val + "s" ); $('#roll').css("animation-duration", val + "s" ); $('#duration-label').text( valRounded ); if(val > mid && labelSide == "right") { labelSide = "left"; $('#duration-label').removeClass("isRight").addClass("isLeft"); } else if(val <= mid && labelSide == "left") { labelSide = "right"; $('#duration-label').removeClass("isLeft").addClass("isRight"); } });
粒子
时间
文字
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号