发送按钮的酷炫动画

来源:https://www.sucaihuo.com/js/2627.html 2017-08-03 23:37浏览(532) 收藏

一款发送按钮的酷炫动画,点击按钮会有一个图标环绕的变形动画,由一个纸飞机变形成一个对号,之后又自动恢复到初始状态,动画效果还是挺不错的哦,喜欢的童鞋请收下吧。
发送按钮的酷炫动画
分类:导航菜单 > 图标导航 难易:初级
查看演示 下载资源 下载积分: 20 积分

页面的head部分,远程调用图标字体库ionicons,并设置好页面元素的样式,代码如下:

<link rel='stylesheet prefetch' href='https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css'>
<style type="text/css">
html {
  box-sizing: border-box;
  font-size: 62.5%;
  overflow: hidden;
}

* {
  padding: 0;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  box-sizing: inherit;
}
*::after, *::before {
  box-sizing: inherit;
}

body .send-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

@keyframes icon-animation {
  0% {
    transform: rotate(0deg) scale(1);
  }
  33% {
    transform: rotate(-120deg) scale(4);
  }
  66% {
    transform: rotate(-240deg) scale(4);
  }
  100% {
    transform: rotate(-360deg) scale(1);
  }
}
@keyframes input-shadow {
  0% {
    box-shadow: 0 3px 3px 0 rgba(0, 0, 0, 0.14), 0 1px 7px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -1px rgba(0, 0, 0, 0.2);
  }
  40% {
    box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);
  }
  50% {
    box-shadow: none;
  }
  70% {
    box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);
  }
  100% {
    box-shadow: 0 3px 3px 0 rgba(0, 0, 0, 0.14), 0 1px 7px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -1px rgba(0, 0, 0, 0.2);
  }
}
.icon-wrapper-animation {
  animation: icon-animation 1.5s linear;
  transition: color 0.6s ease;
  color: #66bb6a;
}

.clicked {
  transform: translate(-50%, calc(-50% + 1px)) !important;
  transition: transform 0.15s ease;
  animation: input-shadow 0.15s ease;
  box-shadow: 0 3px 3px 0 rgba(0, 0, 0, 0.14), 0 1px 7px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -1px rgba(0, 0, 0, 0.2);
}
.clicked > .text {
  transform: translateY(1px);
  transition: transform 0.15s ease-out;
}

body .send-button {
  background-color: #d81b60;
  width: 250px;
  height: 45px;
  border-radius: 3px;
  box-shadow: 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  user-select: none;
  transition: transform 0.15s;
  text-shadow: 1px 2px 1px rgba(77, 9, 36, 0.6);
}
body .send-button .text {
  position: absolute;
  left: 10px;
  font-size: 22px;
  font-size: 2.2rem;
  letter-spacing: 1px;
  line-height: 45px;
  font-family: 'Microsoft YaHei','Lantinghei SC','Open Sans',Arial,'Hiragino Sans GB','STHeiti','WenQuanYi Micro Hei','SimSun',sans-serif;
  font-weight: 500;
  color: #fff;
  text-transform: uppercase;
}
body .send-button .icon-wrapper {
  position: absolute;
  right: -65px;
  bottom: -10px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  line-height: 45px;
  color: #fff;
}
body .send-button .icon-wrapper [class*="icon-"] {
  position: absolute;
  left: 100px;
  bottom: 10px;
  transition: color 0.6s ease;
}
body .send-button .icon-wrapper .icon-1 {
  transform: rotate(15deg);
  font-size: 23px;
  font-size: 2.3rem;
  opacity: 1;
}
body .send-button .icon-wrapper .icon-2 {
  opacity: 0;
  font-size: 25px;
  font-size: 2.5rem;
}
</style>

页面的body部分,多个span标签放入一个div容器里,代码如下:

<div class="send-button">
 <span class="text">发送</span>
  <span class="icon-wrapper">
  	<span class="icon-1 ion-paper-airplane"></span>
		<span class="icon-2 ion-checkmark"></span>
  </span>
</div>

页面的底部,远程调用jQuery库,并引入本地JS文件,代码如下:

<script src='https://code.jquery.com/jquery-2.2.4.min.js'></script>
<script type="text/javascript" src="js/index.js"></script>
评论0
头像

系统已开启自动识别垃圾评论机制,识别到的自动封号,下载出错或者资源有问题请联系全栈客服QQ 1915635791

1 2