您当前的位置: 首页 >  css

彭世瑜

暂无认证

  • 2浏览

    0关注

    2791博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

css:animation@keyframes 实现 CD播放旋转效果

彭世瑜 发布时间:2021-12-19 10:41:15 ,浏览量:2

在这里插入图片描述

@keyframes 设置动画帧

1、from to 用于简单动画,只有起始帧和结束帧 2、百分比 用于复杂动画,动画不止两帧


        html,
        body {
            margin: 0;
            padding: 0;
        }

        body {
            height: 100%;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }

        .cover-wrap {
            width: 200px;
            height: 200px;
            border: 40px solid #000000;
            border-radius: 50%;
            overflow: hidden;
        }

        @keyframes playmusic {

            /* 起始位置 */
            from {
                transform: rotate(0deg);
            }

            /* 结束位置 */
            to {
                transform: rotate(360deg);
            }
        }

        .cover {
            width: 100%;
            height: 100%;
            object-fit: cover;

            /* 动画属性 */
            animation-name: playmusic;
            animation-duration: 4s;
            animation-timing-function: linear;
            animation-iteration-count: infinite;
        }
    

    animation@keyframes 实现 CD播放效果
    
        
    

在线Demo: animation-keyframes.html

参考 CSS3 @keyframes 规则 CSS3 animation(动画) 属性

关注
打赏
1665367115
查看更多评论
立即登录/注册

微信扫码登录

0.3121s