How to achieve the animation of numbers flying after likes?
过去多啦不再A梦2017-05-19 10:18:38
I originally wanted to post the code, but it’s a bit long and troublesome
My cooking is to give the number that pops up and gets bigger to a p
Then add animation style to this p
It’s a bit troublesome to extract the js file. Let me show you my css
`
/Like/
@-webkit-keyframes niceIn {
0% {
opacity: 1;
-webkit-transform: scale(1);
transform: scale(1)
}
50% {
opacity: 1;
-webkit-transform: scale(1.5);
transform: scale(1.5)
}
70% {
-webkit-transform: scale(.8);
transform: scale(.8)
}
100% {
opacity: 1;
-webkit-transform: scale(1);
transform: scale(1)
}
}
@keyframes niceIn {
0% {
opacity: 1;
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1)
}
50% {
opacity: 1;
-webkit-transform: scale(1.5);
-ms-transform: scale(1.5);
transform: scale(1.5)
}
70% {
-webkit-transform: scale(.8);
-ms-transform: scale(.8);
transform: scale(.8)
}
100% {
opacity: 1;
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1)
}
}
@-o-keyframes niceIn{
0% {
opacity: 1;
-o-transform: scale(1);
transform: scale(1)
}
50% {
opacity: 1;
-o-transform: scale(1.5);
transform: scale(1.5)
}
70% {
-o-transform: scale(.8);
transform: scale(.8)
}
100% {
opacity: 1;
-o-transform: scale(1);
transform: scale(1)
}
}
@-moz-keyframes niceIn{
0% {
opacity: 1;
-moz-transform: scale(1);
transform: scale(1)
}
50% {
opacity: 1;
-moz-transform: scale(1.5);
transform:scale(1.5)
}
70% {
-o-transform: scale(.8);
transform: scale(.8)
}
100% {
opacity: 1;
-moz-transform: scale(1);
transform: scale(1)
}
}
.niceIn {
-webkit-animation:niceIn 0.8s .2s ease;
-moz-animation:niceIn 0.8s .2s ease;
-o-animation:niceIn 0.8s .2s ease;
animation:niceIn 0.8s .2s ease;
}
`
我想大声告诉你2017-05-19 10:18:38
Write the animation style, click to switch the class of this style when finished
阿神2017-05-19 10:18:38
Click to trigger animation. Animation can be realized using CSS3 animation