HTML5+CSS3大风车旋转动画代码

版权:原创 更新时间:1年以上
[该文章底部包含文件资源,可根据自己情况,决定是否下载资源使用,时间>金钱,如有需要,立即查看资源]

以下是 HTML5+CSS3大风车旋转动画代码 的示例演示效果:

当前平台(PC电脑)
  • 平台:

部分效果截图:

HTML5+CSS3大风车旋转动画代码

HTML代码(index.html):

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>HTML5+CSS3大风车旋转动画</title>
    <style>

body{
  padding:0px;
  margin:0px;
  background:hsl(212,50%,50%);
}

.sun {
  width:40px;
  height:40px;
  border-radius:360px;
  background:white;
  right:40px;
  top:-120px;
  position:absolute;
  	animation-name: sunrise;
	  animation-duration: 1s;
	  animation-timing-function: ease;
	  animation-iteration-count: 1;	
	  animation-direction: normal;
	  animation-delay: .1;
	  animation-play-state: running;
	  animation-fill-mode: forwards;
}

@keyframes sunrise {

	0% {
		  top: -120px;
	}

25% {
  top:19px;
  right: 40px;
	}

50% {
  top:25px;
  right: 40px;
	}

100% {
  top:18px;
  right: 40px;
	}

}

.wmd1{
   -webkit-transform: scale(.6);
  position:absolute;
  top:120px;
  left:200px;
  perspective: 1000px;
}

.base{ }

.blades{
  width: 350px;
  height: 350px;
  left: 10%;
  top: 10%;
  z-index:2;
  border-radius: 50%;
  position: absolute;
  margin-top: -30px;
  margin-left: 50px;

  animation: spin 6s linear infinite;
}

.blade1 {
  		background: white;
  position:absolute;
	  width:41px;
	  height:139px;
  top:-10px;
  left:150.5px;
  transform:rotate(0deg);
  display:inline-block;
  background:
    linear-gradient(135deg, transparent 20px, white 0),
    linear-gradient(225deg, transparent 20px, white 0),
    linear-gradient(315deg, transparent 20px, white 0),
    linear-gradient(45deg, transparent  20px,  white 0);
  background-position: top left, top right, bottom right, bottom left;
  background-size: 50% 50%;
  background-repeat: no-repeat;
}

.blade2 {
  		background:white;
  position:absolute;
	  width:41px;
	  height:139px;
  top:105.5px;
  left:41px;
  transform:rotate(-90deg);
  display:inline-block;
  background:
    linear-gradient(135deg, transparent 20px, white 0),
    linear-gradient(225deg, transparent 20px, white 0),
    linear-gradient(315deg, transparent 20px, white 0),
    linear-gradient(45deg, transparent  20px,  white 0);
  background-position: top left, top right, bottom right, bottom left;
  background-size: 50% 50%;
  background-repeat: no-repeat;
}

.blade3 {
  		background:white;
  position:absolute;
	  width:41px;
	  height:139px;
  top:105.5px;
  right:41px;
  transform:rotate(-270deg);
  display:inline-block;
  background:
    linear-gradient(135deg, transparent 20px, white 0),
    linear-gradient(225deg, transparent 20px, white 0),
    linear-gradient(315deg, transparent 20px, white 0),
    linear-gradient(45deg, transparent  20px,  white 0);
  background-position: top left, top right, bottom right, bottom left;
  background-size: 50% 50%;
  background-repeat: no-repeat;
}

.blade4 {
  		background:white;
  position:absolute;
	  width:41px;
	  height:139px;
  bottom:-10px;
  left:150.5px;
  transform:rotate(180deg);
  display:inline-block;
  background:
    linear-gradient(135deg, transparent 20px, white 0),
    linear-gradient(225deg, transparent 20px, white 0),
    linear-gradient(315deg, transparent 20px, white 0),
    linear-gradient(45deg, transparent  20px,  white 0);
  background-position: top left, top right, bottom right, bottom left;
  background-size: 50% 50%;
  background-repeat: no-repeat;
}

.vane1{
  width:1px;
  height:350px;
  left:175px;
  background:white;
  position:absolute;
  transform:rotate(90deg);
}

.vane2{
  width:1px;
  height:350px;
  left:171.5px;
  background:white;
  position:absolute;
  transform:rotate(180deg);
}

.base .bottom_base{
  position:absolute;
  width:90px;
  height:100px;
  left:162px;
  border-right: 16px solid transparent;
  border-left: 16px solid transparent;
  border-bottom: 380px solid white;
  opacity:.8;
  z-index:-1;
  top:42.5px;
}

ul{
  position:absolute;
  top:180px;
  left:-30px;
}
li{
  width:10px;
  height:10px;
  background:white;
  padding:2px;
  display:block;
  margin: 30px;
  box-shadow: inset 0px -2px 0px lightgray; 
}

li:nth-child(2){
  position:absolute;
  top:-45px;
  left:20px;
}

li:nth-child(1){
  position:absolute;
  top:35px;
  left:50px;
}

li:nth-child(3){
  position:absolute;
  top:75px;
  left:50px;
}

@keyframes spin {
0% {
   	transform:rotate(0deg);
 }
 100% {
   	transform:rotate(-360deg);
 }
}

</style>

    <script src="js/prefixfree.min.js"></script>

</head>

<body>
  <!-- the windmill -->
<div class="sun"></div>

<div class="wmd1">
  <div class="blades">
    <div class="blade2"></div>
    <div class="blade1"></div>  
    <div class="vane1"></div>
    <div class="blade3"></div>
    <div class="blade4"></div>
    <div class="vane2"></div>
  </div>
  <div class="base">
    <div class="bottom_base">
      <ul>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
      </ul>
    </div>
</div>

  <div class="wmd1">
  <div class="blades">
    <div class="blade2"></div>
    <div class="blade1"></div>  
    <div class="vane1"></div>
    <div class="blade3"></div>
    <div class="blade4"></div>
    <div class="vane2"></div>
  </div>
  <div class="base">
    <div class="bottom_base">
      <ul>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
      </ul>
    </div>
</div>

<div class="wmd1">
  <div class="blades">
    <div class="blade2"></div>
    <div class="blade1"></div>  
    <div class="vane1"></div>
    <div class="blade3"></div>
    <div class="blade4"></div>
    <div class="vane2"></div>
  </div>
  <div class="base">
    <div class="bottom_base">
      <ul>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
      </ul>
    </div>
</div>
</body>
</html>







JS代码(prefixfree.min.js):

/** * StyleFix 1.0.3 & PrefixFree 1.0.7 * @author Lea Verou * MIT license */
(function(){
	function t(e,t){
	return[].slice.call((t||document).querySelectorAll(e))}
if(!window.addEventListener)return;
	var e=window.StyleFix={
	link:function(t){
	try{
	if(t.rel!=="stylesheet"||t.hasAttribute("data-noprefix"))return}
catch(n){
	return}
var r=t.href||t.getAttribute("data-href"),i=r.replace(/[^\/]+$/,""),s=(/^[a-z]{
	3,10}
:/.exec(i)||[""])[0],o=(/^[a-z]{
	3,10}
:\/\/[^\/]+/.exec(i)||[""])[0],u=/^([^?]*)\??/.exec(r)[1],a=t.parentNode,f=new XMLHttpRequest,l;
	f.onreadystatechange=function(){
	f.readyState===4&&l()}
,l=function(){
	var n=f.responseText;
	if(n&&t.parentNode&&(!f.status||f.status<400||f.status>600)){
	n=e.fix(n,!0,t);
	if(i){
	n=n.replace(/url\(\s*?((?:"|')?)(.+?)\1\s*?\)/gi,function(e,t,n){
	return/^([a-z]{
	3,10}
:|#)/i.test(n)?e:/^\/\//.test(n)?'url("'+s+n+'")':/^\//.test(n)?'url("'+o+n+'")':/^\?/.test(n)?'url("'+u+n+'")':'url("'+i+n+'")'}
);
	var r=i.replace(/([\\\^\$*+[\]?{
}
.=!:(|)])/g,"\\$1");
	n=n.replace(RegExp("\\b(behavior:\\s*?url\\('?\"?)"+r,"gi"),"$1")}
var l=document.createElement("style");
	l.textContent=n,l.media=t.media,l.disabled=t.disabled,l.setAttribute("data-href",t.getAttribute("href")),a.insertBefore(l,t),a.removeChild(t),l.media=t.media}
}
;
	try{
	f.open("GET",r),f.send(null)}
catch(n){
	typeof XDomainRequest!="undefined"&&(f=new XDomainRequest,f.onerror=f.onprogress=function(){
}
,f.onload=l,f.open("GET",r),f.send(null))}
t.setAttribute("data-inprogress","")}
,styleElement:function(t){
	if(t.hasAttribute("data-noprefix"))return;
	var n=t.disabled;
	t.textContent=e.fix(t.textContent,!0,t),t.disabled=n}
,styleAttribute:function(t){
	var n=t.getAttribute("style");
	n=e.fix(n,!1,t),t.setAttribute("style",n)}
,process:function(){
	t("style").forEach(StyleFix.styleElement),t("[style]").forEach(StyleFix.styleAttribute)}
,register:function(t,n){
	(e.fixers=e.fixers||[]).splice(n===undefined?e.fixers.length:n,0,t)}
,fix:function(t,n,r){
	for(var i=0;
	i<e.fixers.length;
	i++)t=e.fixers[i](t,n,r)||t;
	return t}
,camelCase:function(e){
	return e.replace(/-([a-z])/g,function(e,t){
	return t.toUpperCase()}
).replace("-","")}
,deCamelCase:function(e){
	return e.replace(/[A-Z]/g,function(e){
	return"-"+e.toLowerCase()}
)}
}
;
	(function(){
	setTimeout(function(){
}
,10),document.addEventListener("DOMContentLoaded",StyleFix.process,!1)}
)()}
)(),function(e){
	function t(e,t,r,i,s){
	e=n[e];
	if(e.length){
	var o=RegExp(t+"("+e.join("|")+")"+r,"gi");
	s=s.replace(o,i)}
return s}
if(!window.StyleFix||!window.getComputedStyle)return;
	var n=window.PrefixFree={
	prefixCSS:function(e,r,i){
	var s=n.prefix;
	n.functions.indexOf("linear-gradient")>-1&&(e=e.replace(/(\s|:|,)(repeating-)?linear-gradient\(\s*(-?\d*\.?\d*)deg/ig,function(e,t,n,r){
	return t+(n||"")+"linear-gradient("+(90-r)+"deg"}
)),e=t("functions","(\\s|:|,)","\\s*\\(","$1"+s+"$2(",e),e=t("keywords","(\\s|:)","(\\s|;
	|\\}
|$)","$1"+s+"$2$3",e),e=t("properties","(^|\\{
	|\\s|;
	)","\\s*:","$1"+s+"$2:",e);
	if(n.properties.length){
	var o=RegExp("\\b("+n.properties.join("|")+")(?!:)","gi");
	e=t("valueProperties","\\b",":(.+?);
	",function(e){
	return e.replace(o,s+"$1")}
,e)}
return r&&(e=t("selectors","","\\b",n.prefixSelector,e),e=t("atrules","@","\\b","@"+s+"$1",e)),e=e.replace(RegExp("-"+s,"g"),"-"),e=e.replace(/-\*-(?=[a-z]+)/gi,n.prefix),e}
,property:function(e){
	return(n.properties.indexOf(e)?n.prefix:"")+e}
,value:function(e,r){
	return e=t("functions","(^|\\s|,)","\\s*\\(","$1"+n.prefix+"$2(",e),e=t("keywords","(^|\\s)","(\\s|$)","$1"+n.prefix+"$2$3",e),e}
,prefixSelector:function(e){
	return e.replace(/^:{
	1,2}
/,function(e){
	return e+n.prefix}
)}
,prefixProperty:function(e,t){
	var r=n.prefix+e;
	return t?StyleFix.camelCase(r):r}
}
;
	(function(){
	var e={
}
,t=[],r={
}
,i=getComputedStyle(document.documentElement,null),s=document.createElement("div").style,o=function(n){
	if(n.charAt(0)==="-"){
	t.push(n);
	var r=n.split("-"),i=r[1];
	e[i]=++e[i]||1;
	while(r.length>3){
	r.pop();
	var s=r.join("-");
	u(s)&&t.indexOf(s)===-1&&t.push(s)}
}
}
,u=function(e){
	return StyleFix.camelCase(e)in s}
;
	if(i.length>0)for(var a=0;
	a<i.length;
	a++)o(i[a]);
	else for(var f in i)o(StyleFix.deCamelCase(f));
	var l={
	uses:0}
;
	for(var c in e){
	var h=e[c];
	l.uses<h&&(l={
	prefix:c,uses:h}
)}
n.prefix="-"+l.prefix+"-",n.Prefix=StyleFix.camelCase(n.prefix),n.properties=[];
	for(var a=0;
	a<t.length;
	a++){
	var f=t[a];
	if(f.indexOf(n.prefix)===0){
	var p=f.slice(n.prefix.length);
	u(p)||n.properties.push(p)}
}
n.Prefix=="Ms"&&!("transform"in s)&&!("MsTransform"in s)&&"msTransform"in s&&n.properties.push("transform","transform-origin"),n.properties.sort()}
)(),function(){
	function i(e,t){
	return r[t]="",r[t]=e,!!r[t]}
var e={
	"linear-gradient":{
	property:"backgroundImage",params:"red,teal"}
,calc:{
	property:"width",params:"1px + 5%"}
,element:{
	property:"backgroundImage",params:"#foo"}
,"cross-fade":{
	property:"backgroundImage",params:"url(a.png),url(b.png),50%"}
}
;
	e["repeating-linear-gradient"]=e["repeating-radial-gradient"]=e["radial-gradient"]=e["linear-gradient"];
	var t={
	initial:"color","zoom-in":"cursor","zoom-out":"cursor",box:"display",flexbox:"display","inline-flexbox":"display",flex:"display","inline-flex":"display",grid:"display","inline-grid":"display","min-content":"width"}
;
	n.functions=[],n.keywords=[];
	var r=document.createElement("div").style;
	for(var s in e){
	var o=e[s],u=o.property,a=s+"("+o.params+")";
	!i(a,u)&&i(n.prefix+a,u)&&n.functions.push(s)}
for(var f in t){
	var u=t[f];
	!i(f,u)&&i(n.prefix+f,u)&&n.keywords.push(f)}
}
(),function(){
	function s(e){
	return i.textContent=e+"{
}
",!!i.sheet.cssRules.length}
var t={
	":read-only":null,":read-write":null,":any-link":null,"::selection":null}
,r={
	keyframes:"name",viewport:null,document:'regexp(".")'}
;
	n.selectors=[],n.atrules=[];
	var i=e.appendChild(document.createElement("style"));
	for(var o in t){
	var u=o+(t[o]?"("+t[o]+")":"");
	!s(u)&&s(n.prefixSelector(u))&&n.selectors.push(o)}
for(var a in r){
	var u=a+" "+(r[a]||"");
	!s("@"+u)&&s("@"+n.prefix+u)&&n.atrules.push(a)}
e.removeChild(i)}
(),n.valueProperties=["transition","transition-property"],e.className+=" "+n.prefix,StyleFix.register(n.prefixCSS)}
(document.documentElement);
	

CSS代码(style.css):

body{padding:0px;margin:0px;background:hsl(212,50%,50%);}
.sun{width:40px;height:40px;border-radius:360px;background:white;right:40px;top:-120px;position:absolute;animation-name:sunrise;animation-duration:1s;animation-timing-function:ease;animation-iteration-count:1;animation-direction:normal;animation-delay:.1;animation-play-state:running;animation-fill-mode:forwards;}
@keyframes sunrise{0%{top:-120px;}
25%{top:19px;right:40px;}
50%{top:25px;right:40px;}
100%{top:18px;right:40px;}
}
.wmd1{-webkit-transform:scale(.6);position:absolute;top:10px;left:200px;perspective:1000px;}
.base{}
.blades{width:350px;height:350px;left:10%;top:10%;z-index:2;border-radius:50%;position:absolute;margin-top:-30px;margin-left:50px;animation:spin 6s linear infinite;}
.blade1{background:white;position:absolute;width:41px;height:139px;top:-10px;left:150.5px;transform:rotate(0deg);display:inline-block;background:linear-gradient(135deg,transparent 20px,white 0),linear-gradient(225deg,transparent 20px,white 0),linear-gradient(315deg,transparent 20px,white 0),linear-gradient(45deg,transparent 20px,white 0);background-position:top left,top right,bottom right,bottom left;background-size:50% 50%;background-repeat:no-repeat;}
.blade2{background:white;position:absolute;width:41px;height:139px;top:105.5px;left:41px;transform:rotate(-90deg);display:inline-block;background:linear-gradient(135deg,transparent 20px,white 0),linear-gradient(225deg,transparent 20px,white 0),linear-gradient(315deg,transparent 20px,white 0),linear-gradient(45deg,transparent 20px,white 0);background-position:top left,top right,bottom right,bottom left;background-size:50% 50%;background-repeat:no-repeat;}
.blade3{background:white;position:absolute;width:41px;height:139px;top:105.5px;right:41px;transform:rotate(-270deg);display:inline-block;background:linear-gradient(135deg,transparent 20px,white 0),linear-gradient(225deg,transparent 20px,white 0),linear-gradient(315deg,transparent 20px,white 0),linear-gradient(45deg,transparent 20px,white 0);background-position:top left,top right,bottom right,bottom left;background-size:50% 50%;background-repeat:no-repeat;}
.blade4{background:white;position:absolute;width:41px;height:139px;bottom:-10px;left:150.5px;transform:rotate(180deg);display:inline-block;background:linear-gradient(135deg,transparent 20px,white 0),linear-gradient(225deg,transparent 20px,white 0),linear-gradient(315deg,transparent 20px,white 0),linear-gradient(45deg,transparent 20px,white 0);background-position:top left,top right,bottom right,bottom left;background-size:50% 50%;background-repeat:no-repeat;}
.vane1{width:1px;height:350px;left:175px;background:white;position:absolute;transform:rotate(90deg);}
.vane2{width:1px;height:350px;left:171.5px;background:white;position:absolute;transform:rotate(180deg);}
.base .bottom_base{position:absolute;width:90px;height:100px;left:162px;border-right:16px solid transparent;border-left:16px solid transparent;border-bottom:380px solid white;opacity:.8;z-index:-1;top:42.5px;}
ul{position:absolute;top:180px;left:-30px;}
li{width:10px;height:10px;background:white;padding:2px;display:block;margin:30px;box-shadow:inset 0px -2px 0px lightgray;}
li:nth-child(2){position:absolute;top:-45px;left:20px;}
li:nth-child(1){position:absolute;top:35px;left:50px;}
li:nth-child(3){position:absolute;top:75px;left:50px;}
@keyframes spin{0%{transform:rotate(0deg);}
100%{transform:rotate(-360deg);}
}
附件:下载该文件资源,减少时间成本(增值服务)
留言
该资源可下载
File Source
.rar
5.11 KB
Html 动画效果1
最新结算
股权转让协议意向书模板
类型: .docx 金额: CNY 2.23¥ 状态: 待结算 详细>
股权转让协议意向书模板
类型: .docx 金额: CNY 0.28¥ 状态: 待结算 详细>
CSS3图片向上3D翻转渐隐消失特效
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
CSS3图片向上3D翻转渐隐消失特效
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
.net c# 将金额转人名币大写金额
类型: .rar 金额: CNY 2.39¥ 状态: 待结算 详细>
.net c# 将金额转人名币大写金额
类型: .rar 金额: CNY 0.3¥ 状态: 待结算 详细>
合伙退伙协议书范本模板
类型: .doc 金额: CNY 2.23¥ 状态: 待结算 详细>
合伙退伙协议书范本模板
类型: .doc 金额: CNY 0.28¥ 状态: 待结算 详细>
合伙退伙协议书范本模板
类型: .doc 金额: CNY 2.23¥ 状态: 待结算 详细>
合伙退伙协议书范本模板
类型: .doc 金额: CNY 0.28¥ 状态: 待结算 详细>
我们力求给您提供有用的文章,再此基础上,会附加营收资源,不做任何广告,让平台可以更好发展 若您发现您的权利被侵害,或使用了您的版权,请发邮件联系 sunlifel@foxmail.com ggbig觉得 : 不提供源码的文章不是好文章
合作伙伴
联系我们
  • QQ:21499807
  • 邮箱:sunlifel@foxmail.com
  • QQ扫一扫加QQ
    QQ扫一扫
Copyright 2023-2024 ggbig.com·皖ICP备2023004211号-1
打赏文章