0
点赞
收藏
分享

微信扫一扫

为你心仪的她做一个 “旋转木马“告白相册【零基础纯 CSS3 实现】

TiaNa_na 2022-10-12 阅读 175

💳 效果展示:


💳 源码获取: 


💳 源码分析: 

💳 布局分析:


💳 动画设置: 

 section{
            transform: translate(-50% -50%);
            transform-style: preserve-3d;
            animation: rotate 8s linear infinite;
        }
 section:hover{
            animation-play-state: paused;
        }
  @keyframes move{
             0%{
                translate: translate(-1000px ,-1000px);
             }
             100%{
                transform: translate(0,100px);
             }
        }
        @keyframes rotate{
            0%{
                transform: rotateX(-7deg) rotateY(0);
            }
            100%{
                transform:rotateX(-7deg) rotateY(360deg);
            }
        }

💳 主要代码:

@keyframes move{
             0%{
                translate: translate(-1000px ,-1000px);
             }
             100%{
                transform: translate(0,100px);
             }
        }
        @keyframes rotate{
            0%{
                transform: rotateX(-7deg) rotateY(0);
            }
            100%{
                transform:rotateX(-7deg) rotateY(360deg);
            }
        }
        section div:nth-child(1){
            -webkit-box-reflect: below 5px linear-gradient(transparent,rgba(0,0,0,.3));
            transform: translateZ(470px);
            background-image: url(./img/1.jpg);
        }
        section div:nth-child(2){
            -webkit-box-reflect: below 5px linear-gradient(transparent,rgba(0,0,0,.3));
            transform: rotateY(45deg) translateZ(470px);
            background-image: url(./img/2.png);
        }
        section div:nth-child(3){
            -webkit-box-reflect: below 5px linear-gradient(transparent,rgba(0,0,0,.3));
            transform: rotateY(90deg) translateZ(470px);
            background-image: url(./img/3.png);
        }
        section div:nth-child(4){
            -webkit-box-reflect: below 5px linear-gradient(transparent,rgba(0,0,0,.3));
            transform: rotateY(135deg) translateZ(470px);
            background-image: url(./img/4.gif);
        }
        section div:nth-child(5){
            -webkit-box-reflect: below 5px linear-gradient(transparent,rgba(0,0,0,.3));
            transform: rotateY(180deg) translateZ(470px);
            background-image: url(./img/5.webp);
        }
        section div:nth-child(6){
            -webkit-box-reflect: below 5px linear-gradient(transparent,rgba(0,0,0,.3));
            transform: rotateY(225deg) translateZ(470px);
            background-image: url(./img/6.webp);
        }
        section div:nth-child(7){
            -webkit-box-reflect: below 5px linear-gradient(transparent,rgba(0,0,0,.3));
            transform: rotateY(270deg) translateZ(470px);
            background-image: url(./img/7.jpg);
        }
        section div:nth-child(8){
            -webkit-box-reflect: below 5px linear-gradient(transparent,rgba(0,0,0,.3));
            transform: rotateY(315deg) translateZ(470px);
            background-image: url(./img/8.png);
        }
举报

相关推荐

0 条评论