11 Star 37 Fork 20

Baryy / You-need-to-know-css

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
circular-smooth.md 3.52 KB
一键复制 编辑 原始数据 按行查看 历史
songhw 提交于 2018-03-13 18:31 . :bug:fix: path 1px bug

延轨迹平滑效果

?> 背景知识::point_right: animation, transition, transform, animation-delay

“transform-origin 只是一个语法糖而已。实际上你总是可以用 translate() 来代替它。” [——James Anderson](/Aryeh Gregor)

<script v-pre type="text/x-template" id="circular-smooth"> <style> main { width: 100%; height: 529px; display: flex; flex-direction: column; align-items: center; } .path { width: 300px; height: 300px; border-radius: 50%; margin: 100px auto; position: relative; display: flex; border: 1px solid #b4a078; } .logo { width: 52px; margin: auto; background: #FFF; } .avatar { width: 50px; position: absolute; top: 124px; left: 124px; animation: circular-smooth-spin 7.5s infinite linear; animation-play-state: running; } .avatar > span { font-weight: 500; position: absolute; white-space: nowrap; top: -50%; left: 50%; padding: 3px 12px; opacity: 0; transform: scale(0); transition: opacity, transform .8s; transform-origin: 0 bottom; } .avatar > img { width: inherit; border-radius: 50%; overflow: hidden; } .path:hover .avatar { animation-play-state: paused; } .path:hover .avatar > span { opacity: 1; transform: scale(1); transition: opacity, transform .8s; } .avatar:nth-of-type(2){ animation-delay: -1.5s; } .avatar:nth-of-type(3){ animation-delay: -3s; } .avatar:nth-of-type(4){ animation-delay: -4.5s; } .avatar:nth-of-type(5){ animation-delay: -6s; } @keyframes circular-smooth-spin { from { transform: rotate(0turn) translateY(-124px) rotate(1turn) } to { opacity: 1; transform: rotate(1turn) translateY(-124px) rotate(0turn) } } </style>
Evan You
Damian Dulisz
defcc
Edd Yerburgh
Sarah Drasner
<script> </script> </script>

!> 如有疑问,后续会添加细节的讲解~

浏览器支持

<iframe src="https://caniuse.bitsofco.de/embed/index.html?feat=css-animation&periods=future_1,current,past_1,past_2,past_3&accessible-colours=false" frameborder="0" width="100%" height="436px"></iframe> <iframe src="https://caniuse.bitsofco.de/embed/index.html?feat=transforms2d&periods=future_1,current,past_1,past_2,past_3&accessible-colours=false" frameborder="0" width="100%" height="458px"></iframe> <iframe src="https://caniuse.bitsofco.de/embed/index.html?feat=css-transitions&periods=future_1,current,past_1,past_2,past_3&accessible-colours=false" frameborder="0" width="100%" height="458px"></iframe>
CSS
1
https://gitee.com/lhammer/You-need-to-know-css.git
git@gitee.com:lhammer/You-need-to-know-css.git
lhammer
You-need-to-know-css
You-need-to-know-css
master

搜索帮助