How to realize the Animation effect of bounce by JavaScript
This article mainly explains "JavaScript how to achieve bounce animation effect", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "JavaScript how to achieve bounce animation effect" bar!
The code is as follows:
Document # box {width:200px; height:200px; position:absolute; top:0; left:200px; background:lightblue;} .btn {position:absolute; top:200px; left:100px; height:50px;} .btn input {display:inline-block; margin-left:50px; outline: none; width:100px Height:50px; border:1px solid green; cursor:pointer;} var oBox = document.getElementById ("box"); var minLeft = 0; var maxLeft = utils.win ('clientWidth')-oBox.offsetWidth; var step = 5; var timer = null; function move (target) {/ / target: tell me the target position to move window.clearTimeout (timer) Var curLeft = utils.css (oBox, "left"); if (curLefttarget) {/ / Border utils.css (oBox, "left", target); return;} curLeft+=step; utils.css (oBox, "left", curLeft)} else if (curLeft > target) {/ / left if (curLeft-steptarget) {/ / left if (curLeft-step)