css clip-path变形动画效果代码

代码语言:html

所属分类:动画

代码描述:css clip-path变形动画效果代码

代码标签: 动画 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="UTF-8">





    <style>
        html {
            background-color: #222;
            font-family: arial;
        }
        body {
            margin: 0;
            display: flex;
            height: 100vh;
        }
        .box {
            position: relative;
            width: 40vmin;
            height: 40vmin;
            margin: auto;
        }
        .box::before, .box::after {
            clip-path: polygon(100% 100%, 50% 0%, 50% 0%, 50% 0%, 50% 0%, 50% 0%, 0% 100%);
            animation: anim 4s infinite alternate;
        }
        .box::before {
            content: "";
            display: block;
            position: absolute;
            top: 0;
            left: 0;
            width: 40vmin;
            height: 40vmin;
            background-color: #ffdd40;
        }

        .box::after {
            content: "";
            display: block;
            position: absolute;
            top: 5px;
            left: 5px;
            width: calc(40vmin - 10px);
            height: calc(40vmin - 9px);
            background-size: 400% 400%;
            background: #ee7752;
            animation: anim 4s infinite alternate, gradient 4s infinite alternate;
        }

@keyframes anim {
            0%, 5% {
                clip-path: polygon(50% 0%, 50% 0%, 100% 100%, 0% 100%, 0% 100% ,0% 100% , 0% 100%);
            }
            25% {
                clip-path: polygon(0% 0%, 100% 0%, 100% 0%, 100% 100%, 100% 100%, 100% 100%, 0% 100%);
            }
            50% {
                clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 82% 100%, 82% 100%, 18% 100%, 0% 38%);
            }
            7.........完整代码请登录后点击上方下载按钮下载查看

网友评论0