html直播点赞特效,CSS3实现红心点赞特效
1.創建html
2. css
.heart {
background: url(http://demo.htmleaf.com/1511/201511131551/images/web_heart_animation.png);
background-position: left;
background-repeat: no-repeat;
height: 100px;
width: 100px;
cursor: pointer;
position: absolute;
left: -14px;
background-size: 2900%;
}
.heart:hover,
.heart:focus {
background-position: right;
}
@-webkit-keyframes heartBlast {
0% {
background-position: left;
}
100% {
background-position: right;
}
}
@keyframes heartBlast {
0% {
background-position: left;
}
100% {
background-position: right;
}
}
.heartAnimation {
display: inline-block;
-webkit-animation-name: heartBlast;
animation-name: heartBlast;
-webkit-animation-duration: .8s;
animation-duration: .8s;
-webkit-animation-iteration-count: 1;
animation-iteration-count: 1;
-webkit-animation-timing-function: steps(28);
animation-timing-function: steps(28);
background-position: right;
}
@-webkit-keyframes dorsyHover {
0% {
-webkit-box-shadow: 0 0 1px 1px #aaa30a;
}
50% {
-webkit-box-shadow: 0 0 1px 1px #fdfbc4;
}
100% {
-webkit-box-shadow: 0 0 1px 1px yellow;
}
}
@-webkit-keyframes dorsyDelete {
0% {
-webkit-transform: rotate(0deg);
}
40% {
-webkit-transform: rotate(10deg);
}
80% {
-webkit-transform: rotate(-10deg);
}
100% {
-webkit-transform: rotate(0deg);
}
}
3.js 點擊事件添加類名
4.核心語義
1.backgroundbackground-position: left; (結束為right)
3.animate-duration:1s;(動畫運行時間)
4.animation-iteration-count :n / infinite ;(循環次數 n 不限)
5.animation-timing-function: steps(28);
速度曲線,使用三次貝塞爾函數的數學函數來生成速度曲線
參數為steps時:
第一個參數指定了時間函數中的間隔數量(必須是正整數)
第二個參數可選,接受 start 和 end 兩個值,指定在每個間隔的起點或是終點發生階躍變化,默認為 end。
step-start等同于steps(1,start),動畫分成1步,動畫執行時為開始左側端點的部分為開始;
step-end等同于steps(1,end):動畫分成一步,動畫執行時以結尾端點為開始,默認值為end。
steps() 第一個參數 number 為指定的間隔數,即把動畫分為 n 步階段性展示,估計大多數人理解就是keyframes寫的變化次數
作者:AstarX
鏈接:https://www.jianshu.com/p/753c4ea0c18c
總結
以上是生活随笔為你收集整理的html直播点赞特效,CSS3实现红心点赞特效的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Linux上创建vsftpd用户,lin
- 下一篇: python 根据三点坐标计算夹角