原生js实现文字翻牌动画显示效果
代码语言:html
所属分类:动画
代码描述:原生js实现文字翻牌动画显示效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> @import url("https://fonts.googleapis.com/css?family=Fjalla+One&display=swap"); .numCounter { display: inline-block; height: 90px; line-height: 90px; text-shadow: 0 0 2px #fff; font-weight: bold; white-space: normal; font-size: 60px; } .numCounter > div { display: inline-block; vertical-align: top; height: 100%; } .numCounter > div > b { display: inline-block; width: 64.2857142857px; height: 100%; margin: 0 0.1em; border-radius: 8px; text-align: center; text-shadow: 2px 1px 3px rgba(0, 0, 0, 0.2); box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.1) inset, -2px -2px 2px rgba(255, 255, 255, 0.12) inset; overflow: hidden; } .numCounter > div > b::before { content: ' 0 1 2 3 4 5 6 7 8 9 '; display: block; word-break: break-all; word-break: break-word; -webkit-transition: 0.5s cubic-bezier(0.75, 0.15, 0.6, 1.15), text-shadow 150ms; transition: 0.5s cubic-bezier(0.75, 0.15, 0.6, 1.15), text-shadow 150ms; } .numCounter > div > b.blur { opacity: .8; text-shadow: 2px 1px 3px rgba(0, 0, 0, 0.2), 0 0.1em 2px rgba(255, 255, 255, 0.6), 0 0.3em 3px rgba(255, 255, 255, 0.3), 0 -0.1em 2px rgba(255, 255, 255, 0.6), 0 -0.3em 3px rgba(255, 255, 255, 0.3); } .numCounter > div > b[data-value="1"]::before { margin-top: -90px; } .numCounter > div > b[data-value="2"]::before { margin-top: -180px; } .numCounter > div > b[data-value="3"]::before { margin-top: -270px; } .numCounter > div > b[data-value="4"]::before { margin-top: -360px; } .numCounter > div > b[data-value="5"]::before { margin-top: -450px; } .numCounter > div > b[data-value="6"]::before { margin-top: -540px; } .numCounter > div > b[data-value="7"]::before { margin-top: -630px; } .numCounter > div > b[data-value="8"]::before { margin-top: -720px; } .numCounter > div > b[data-value="9"]::before { margin-top: -810px; } .numCounter > div:nth-last-child(3n):not(:first-child)::before { content: ","; display: inline; font-size: 1.1em; opacity: .6; color: white; } html, body { height: 100%; } body { display: -webkit-box; display: flex; -webkit-box-align: center; align-items: center; -webkit-box-pack: center; justify-content: center; background: #55b9f3; font-family: 'Fjalla One', Arial; -webkit-perspective: 1000px; perspective: 1000px; } asid.........完整代码请登录后点击上方下载按钮下载查看
网友评论0