HTML:实现旋转地球特效

运行效果

在这里插入图片描述

代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        div{
            width: 500px;
            height: 500px;
            margin: 10px auto;
            overflow: hidden;
            position: relative;
            border-radius: 100%;
            animation: shadow 10s infinite linear;
        }
        div:hover{
            animation-play-state:paused;
        }
        img{
            -webkit-user-drag: none;
        }
        .earth1{
            width: 1024px;
            height: 512px;
            position: absolute;
            left: 0;
            top: 0;
            animation: earth1 10s infinite linear;
        }
        .earth2{
            width: 1024px;
            height: 512px;
            position: absolute;
            left: 200%;
            top: 0;
            animation: earth2 10s infinite linear ;
        }
        @keyframes earth1 {
            0%{left: 0}
            100%{left: -200%}
        }
        @keyframes earth2 {
            0%{left: 200%}
            100%{left: 0}
        }
        @keyframes shadow {
            from{ box-shadow: 10px 10px 5px #888888;}
            to{ box-shadow: -10px 10px 5px #888888;}
        }
    </style>
</head>
<body>
<div>
    <img class="earth1" src="earth.jpg" alt="">
    <img class="earth2" src="earth.jpg" alt="">
</div>
</body>
</html>

素材

在这里插入图片描述

已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 书香水墨 设计师:CSDN官方博客 返回首页