吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 2406|回复: 13
收起左侧

[其他转载] 纯css实现旋转木马效果

  [复制链接]
tanzhongfa2 发表于 2022-3-16 10:33
css代码
<style>
        body {
            perspective: 1000px;
        }
        
        section {
            position: relative;
            width: 300px;
            height: 200px;
            margin: 150px auto;
            transform-style: preserve-3d;
            /* 添加动画效果 */
            animation: rotate 10s linear infinite;
            background: url(media/pig.jpg) no-repeat;
        }
        
        section:hover {
            /* 鼠标放入section 停止动画 */
            animation-play-state: paused;
        }
        
        @keyframes rotate {
            0% {
                transform: rotateY(0);
            }
            100% {
                transform: rotateY(360deg);
            }
        }
        
        section div {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: url(media/dog.jpg) no-repeat;
        }
        
        section div:nth-child(1) {
            transform: rotateY(0) translateZ(300px);
        }
        
        section div:nth-child(2) {
            /* 先旋转好了再 移动距离 */
            transform: rotateY(60deg) translateZ(300px);
        }
        
        section div:nth-child(3) {
            /* 先旋转好了再 移动距离 */
            transform: rotateY(120deg) translateZ(300px);
        }
        
        section div:nth-child(4) {
            /* 先旋转好了再 移动距离 */
            transform: rotateY(180deg) translateZ(300px);
        }
        
        section div:nth-child(5) {
            /* 先旋转好了再 移动距离 */
            transform: rotateY(240deg) translateZ(300px);
        }
        
        section div:nth-child(6) {
            /* 先旋转好了再 移动距离 */
            transform: rotateY(300deg) translateZ(300px);
        }
    </style>
html源码
  <section>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
</section>

免费评分

参与人数 1吾爱币 +1 热心值 +1 收起 理由
唐小样儿 + 1 + 1 我很赞同!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

 楼主| tanzhongfa2 发表于 2022-3-16 12:56
空若野 发表于 2022-3-16 11:26
有专门的代码块,这个排版有点不好看

抱歉,以后会进行改进的哦
bdcpc 发表于 2022-3-16 10:45
jjooy 发表于 2022-3-16 11:02
987fw 发表于 2022-3-16 11:08
支持楼主,以前淘宝装修学了一点的,现在淘宝店太差了,不想折腾了。
Leon521 发表于 2022-3-16 11:10
学习了, 对我这小白, 正好拿来练手
喵啊 发表于 2022-3-16 11:10
图呢?没图跑不动啊
空若野 发表于 2022-3-16 11:26
有专门的代码块,这个排版有点不好看
qwety20185 发表于 2022-3-16 11:29
css简直是程序员一生之敌,这东西到底怎么学
sjc900618 发表于 2022-3-16 12:06
牛!前排学习一下!感谢分享~
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止灌水或回复与主题无关内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-5-9 22:04

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表