欢迎来到DIVCSS5查找CSS资料与学习DIV CSS布局技术!
  代码解读
 
  没有dom元素,直接写css。
 
  设置页面空间:
 
  body{
 
  position:fixed;
 
  margin:0;
 
  width:100vw;
 
  height:100vh;
 
  }
 
  用伪元素设置背景图案:
 
  
 
  body::before{
 
  content:'';
 
  position:fixed;
 
  width:200vmax;
 
  height:200vmax;
 
  background-color:steelblue;
 
  color:turquoise;
 
  background-image:
 
  linear-gradient(
 
  45deg,
 
  currentColor25%,
 
  transparent25%,transparent75%,
 
  currentColor75%),
 
  linear-gradient(
 
  45deg,
 
  currentColor25%,
 
  transparent25%,transparent75%,
 
  currentColor75%);
 
  background-position:00,5vmax5vmax;
 
  background-size:10vmax10vmax;
 
  平移背景图案:
 
  
 
  body::before{
 
  top:50%;
 
  left:50%;
 
  animation:
 
  9smoveinfiniteease-in-outalternate;
 
  }
 
  @keyframesmove{
 
  from{
 
  left:-40%;
 
  top:-40%;
 
  }
 
  to{
 
  left:-60%;
 
  top:-60%;
 
  }
 
  }
 
  让背景图案转动起来:
 
  body::before{
 
  animation:
 
  9smoveinfiniteease-in-outalternate,
 
  9s-1.5srotatinginfiniteease-in-outalternate;
 
  }
 
  @keyframesrotating{
 
  to{
 
  transform:rotate(180deg);
 
  }
 
  }
 
  平移页面:
 
  body{
 
  top:50%;
 
  left:50%;
 
  animation:
 
  3smoveinfiniteease-in-outalternate;
 
  }
 
  缩放页面:
 
  body{
 
  animation:
 
  3smoveinfiniteease-in-outalternate,
 
  3szoominfiniteease-in-outalternate;
 
  }
 
  @keyframeszoom{
 
  to{
 
  transform:scale(10);
 
  }
 
  }
 
  最后,增加变色效果:
 
  @keyframesrotating{
 
  to{
 
  transform:rotate(180deg);
 
  filter:hue-rotate(1turn);
 
  }
 
  }
 
  大功告成!

1315127971-5b735e6f1e46e_articlex.gif



本文转载自中文网

 

如需转载,请注明文章出处和来源网址:http://www.divcss5.com/css3-style/c56821.shtml