border-radius结合动画创建酷炫的效果

栏目: Html · 发布时间: 7年前

  • CSS3圆角只需设置一个属性:border-radius(含义是"边框半径")。你为这个属性提供一个值,就能同时设置四个圆角的半径。所有合法的CSS度量值都可以使用:em、ex、pt、px、百分比等等。不允许负值。
  • 椭圆的水平半径"(horizontal radius)和"垂直半径"(vertical radius)如border-radius: 15px;
    border-radius结合动画创建酷炫的效果

border-radius: 30% 70% 20% 40%图解

border-radius结合动画创建酷炫的效果

border-radius: 4em 8em及border-radius: 4em / 8em 图解

border-radius结合动画创建酷炫的效果

border-radius 70% 30% 30% 70% / 60% 40% 60% 40%解释

border-radius结合动画创建酷炫的效果
border-radius结合动画创建酷炫的效果

border-radius结合动画应用

border-radius结合动画创建酷炫的效果
* {
  box-sizing: border-box;
}
body {
  background: #003;
}

.container {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.box {
  width: 60vmin;
  height: 60vmin;
  border: 1px dashed rgba(255,255,255,0.4);
  position: relative;
  
  &::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    border-radius: 50%;
    border: 1px dashed rgba(255,255,255,0.4);
    transform: scale(1.42);
  }
}

.spin-container {
  width: 100%;
  height: 100%;
  animation: spin 12s linear infinite;
  position: relative;
}

.shape {
  width: 100%;
  height: 100%;
  transition: border-radius 1s ease-out;
  border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
  animation: morph 8s ease-in-out infinite both alternate;
  position: absolute;
  overflow: hidden;
  z-index: 5;
}

.bd {
  width: 142%;
  height: 142%;
  position: absolute;
  left: -21%;
  top: -21%;
  background: url(https://images.unsplash.com/photo-1519345182560-3f2917c472ef?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=2868fd5c3f30697d38732224e0ef51ed);
  background-size: 100%;
  background-position: center center;
  display: flex;
  color: #003;
  font-size: 5vw;
  font-weight: bold;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-transform: uppercase;
  animation: spin 12s linear infinite reverse;
  opacity: 1;
  z-index: 2;
}

@keyframes morph {
  0% {border-radius: 40% 60% 60% 40% / 60% 30% 70% 40%;} 
  100% {border-radius: 40% 60%;} 
}

@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}
复制代码

参考链接


以上所述就是小编给大家介绍的《border-radius结合动画创建酷炫的效果》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

大教堂与集市

大教堂与集市

[美] Eric S. Raymond / 卫剑钒 / 机械工业出版社 / 2014-5 / 59.00元

当代软件技术领域最重要的著作,中文版首次出版! 《大教堂与集市》是开源运动的《圣经》,颠覆了传统的软件开发思路,影响了整个软件开发领域。作者Eric S. Raymond是开源运动的旗手、黑客文化第一理论家,他讲述了开源运动中惊心动魄的故事,提出了大量充满智慧的观念和经过检验的知识,给所有软件开发人员带来启迪。本书囊括了作者最著名的“五部曲”,并经过作者的全面更新,增加了大量注释,提高了可读......一起来看看 《大教堂与集市》 这本书的介绍吧!

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试