Seeing the recent popular WeChat tap function, I reviewed the CSS3 animation, so I wrote this box shaking animation and added the QQ window shaking. @-webkit-keyframes shake { 0% { -webkit-transform: translate(2px, 2px); } 25% { -webkit-transform: translate(-2px, -2px); } 50% { -webkit-transform: translate(0px, 0px); } 75% { -webkit-transform: translate(2px, -2px); } 100% { -webkit-transform: translate(-2px, 2px); } } @keyframes shake { 0% { transform: translate(2px, 2px); } 25% { transform: translate(-2px, -2px); } 50% { transform: translate(0px, 0px); } 75% { transform: translate(2px, -2px); } 100% { transform: translate(-2px, 2px); } } .shake { position: relative; top: 30px; left: 100px; height: 200px; width: 200px; color: #ff0000; background: #000; } .shake:hover { -webkit-animation: shake 0.2s infinite; animation: shake 0.2s infinite; } /*Activity swing animation*/ @-webkit-keyframes swing { 10% { transform: rotate(15deg); } 20% { transform: rotate(-10deg); } 30% { transform: rotate(5deg); } 40% { transform: rotate(-5deg); } 50%,100% { transform: rotate(0deg); } } @-moz-keyframes swing { 10% { transform: rotate(15deg); } 20% { transform: rotate(-10deg); } 30% { transform: rotate(5deg); } 40% { transform: rotate(-5deg); } 50%,100% { transform: rotate(0deg); } } @-o-keyframes swing { 10% { transform: rotate(15deg); } 20% { transform: rotate(-10deg); } 30% { transform: rotate(5deg); } 40% { transform: rotate(-5deg); } 50%,100% { transform: rotate(0deg); } } @keyframes swing { 10% { transform: rotate(12deg); } 20% { transform: rotate(-11.5deg); } 30% { transform: rotate(1deg); } 40% { transform: rotate(-1deg); } 50%,100% { transform: rotate(0.5deg); } } .stagger { background-color: #ff0000; width: 60px; height: 60px; } .stagger1{ animation: swing .5s .15s linear 1; /* animation-play-state: paused; */ } <!-- qq window shakes--> <div class="shake">qq window shake</div> <!-- WeChat avatar shaking--> <div class="stagger">WeChat pat avatar shaking</div> document.querySelector('.stagger').addEventListener('click', function() { document.querySelector('.stagger').classList.add('stagger1') console.log('papa nudged baby') }) /*Each click implements the animation, pay attention to the end of the monitoring animation, remove the animation class, and then add the animation class document.querySelector('.stagger').addEventListener('animationend', function() { document.querySelector('.stagger').classList.remove('stagger1') }) This is the end of this article about how to implement WeChat tap animation effects based on CSS3 animation attributes. For more relevant CSS3 WeChat tap function content, please search 123WORDPRESS.COM’s previous articles or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! |
<<: SQL ROW_NUMBER() and OVER() method case study
Table of contents 1. List traversal 2. The role o...
Problem code Look at a closure problem code cause...
Table of contents Preface Creating a component li...
Preface During the interview, many interviewers m...
summary During the interview, when discussing abo...
A brief introduction to protobuf Protobuf is Goog...
CSS matches multiple classes The following HTML t...
Official website: http://code.google.com/p/zen-cod...
In the actual project development process, the pag...
environment: 1. Windows Server 2016 Datacenter 64...
1. Query process show processlist 2. Query the co...
Table of contents Preface Input box component lay...
After nginx is compiled and installed and used fo...
Table of contents 1. Installation 2. Introduction...
The default varchar type in MySQL is case insensi...