svg+css实现黑蝙蝠展翅飞翔动画效果代码

代码语言:html

所属分类:动画

代码描述:svg+css实现黑蝙蝠展翅飞翔动画效果代码

代码标签: 蝙蝠 展翅 飞翔 动画 效果

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

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">





    <style>
        :root {
        	--basecolor: hsl(20, 70%, 40%);
        }
        
        body {
        	background: #222;
        	text-align: center;
        }
        
        /* Layout and font */
        .wrapper {
        	width: 700px;
        	position: relative;
        	margin: auto;
        }
        
        .bat-overlay,
        .text {
        	width: 100%;
        	height: 100%;
        	position: absolute;
        	top: 0;
        	left: 0;
        }
        
        h1 {
        	text-align: center;
        	color: var(--basecolor);
        	line-height: 0.9em;
        	font-size: 6em;
        	margin: 0.5em 0em 0.5em 0em;
        	font-family: "Creepster", cursive;
        }
        
        .dark {
        	color: #000;
        	transition: 0.5s;
        	transition-timing-function: ease-in-out;
        	opacity: 0.5;
        }
        
        .light {
        	transition: 0.5s;
        	transition-timing-function: ease-in-out;
        }
        
        .bat-overlay {
        	z-index: 10;
        	pointer-events: none;
        }
        
        /* Dropdown*/
        
        #monster-select {
        	background: rgba(0, 0, 0, 0.3);
        	border: none;
        	padding: 10px;
        	color: var(--basecolor);
        	border-radius: 10px;
        	font-size: 1.2em;
        	font-family: "Creepster", arial;
        }
        
        .dropdown {
        	font-size: 1em;
        	color: var(--basecolor);
        }
        
        .close {
        	transition: 1s;
        	opacity: 0;
        }
        
        select {
        	outline: none;
        	-webkit-appearance: none;
        }
        select:-moz-focusring {
        	color: transparent;
        	text-shadow: 0 0 0 #000;
        }
        
        /* Bats*/
        svg {
        	width: 100%;
        }
        
        .eye {
        	fill: var(--basecolor);
        }
        
        .shadow {
        	-webkit-filter: blur(6px);
        	filter: blur(6px);
        	opacity: 0.2;
        }
        
        .bat {
        	animation-direction: normal;
        	animation: move 15s infinite;
        	animation-timing-function: ease-in-out;
        	transform-origin: 50% 50%;
        }
        
        .bat1 {
        	animation-direction: normal;
        	animation: move1 15s infinite;
        	animation-timing-function: ease-in-out;
        	transform-origin: 50% 50%;
        }
        
        .bat2 {
        	animation-direction: normal;
        	animation: move2 15s infinite;
        	animation-timing-function: ease-in-out;
        	transform-origin: 50% 50%;
        }
        
        .wing {
        	transform-origin: 50% 50%;
        	animation-direction: normal;
        	animation: wing 1s infinite;
        	animation-timing-function: ease-in-out;
        }
        
        .wing1 {
        	transform-origin: 50% 50%;
        	animation-direction: normal;
        	animation: wing1 1s infinite;
        	animation-timing-function: ease-in-out;
        }
        
        @keyframes move {
        	0% {
        		transform: translate(150px, 90px) rotate(10deg);
        	}
        	25% {
        		transform: translate(-150px, 90px) rotate(-10deg);
        	}
        	50% {
        		transform: translate(-160px, -80px) rotate(10deg);
        	}
        	75% {
        		transform: translate(-140px, -100px) rotate(-10deg);
        	}
        
        	100% {
        		transform: translate(150px, 90px) rotate(10deg);
        	}
        }
        
        @keyframes move1 {
        	0% {
        		transform: translate(-140px, -70px) rotate(-10deg);
        	}
        	25% {
        		transform: translate(0px, -50px) rotate(10deg);
        	}
        	50% {
        		transform: translate(150px, 50px) rotate(-10deg);
        	}
        	75% {
        		transform: translate(-100px, 30px) rotate(10deg);
        	}
        	85% {
        		transform: translate(-110px, 90px) rotate(10deg);
        	}
        
        	100% {
        		transform: translate(-140px, -70px) rotate(-10deg);
        	}
        }
        
        @keyframes move2 {
        	0% {
        		transform: translate(150px, -70px) scale(1) rotate(10deg);
        	}
        	25% {
        		transform: translate(160px, -90px) scale(0.7) rotate(-10deg);
        	}
        	50% {
        		transform: translate(170px, -100px) scale(0.7) rotate(10deg);
        	}
        	75% {
        		transform: translate(105px, -80px) scale(1) rotate(-10deg);
        	}
        
        	100% {
        		transform: translate(150px, -70px) scale(1) rotate(10deg);
        	}
        }
        
        @keyframes wing {
        	0% {
        		transform: translate(0px, 0px) scale(1) rotate(0deg);
        	}
        	50% {
        		transform: translate(0px, 0px) scaleX(0.5) rotate(-25deg);
        	}
        	100% {
        		transform: translate(0px, 0px) scale(1) rotate(0deg);
        	}
        }
        
        @keyframes wing1 {
        	0% {
        		transform: translate(0px, 0px) scale(1) rotate(0deg);
        	}
        	50% {
        		transform: translate(0px, 0px) scaleX(0.5) rotate(25deg);
        	}
        	100% {
        		transform: translate(0px, 0px) scale(1) rotate(0deg);
        	}
        }
        
        /* Mobile*/
        @media screen and (max-width: 600px) {
        	.wrapper {
        		width: 100% !important;
        	}
        	h1 {
        		font-size: 2em;
        	}
        }
    </style>


</head>

<body>
    <div class="wrapper">
        <div class=" bat-overlay">

            <!-- Bats -->
            <svg version="1.1" id="Lager_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 600 400" style="enable-background:new 0 0 600 400;" xml:space="preserve">

		<g class="bat">
			<path d="M306.9,145.4l-7.3,7.3l-7.3-7.3c-0.6-0.6-1.6-0.2-1.6,0.6v7.9h7.6h2.5h7.6V146C308.5,145.2,307.5,144.8,306.9,145.4z&quo.........完整代码请登录后点击上方下载按钮下载查看

网友评论0