<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ptml xmlns = "http://www.w3.org/1999/xhtml"> <pead> <meta http-equiv =" content-Type "content =" text/html; charset = gb2312 "/> <title> high simulation spring vibrator (compression version) </title> </pead> <body> after setting, activate the element and click me !! <P> <input type = "button" value = "reactivate element" id = "back" style = "width: 100px; height: 25px; top: 220px; left: 500px; "onclick =" Back () "/> after running, please activate it again <br> initial speed (unit: pixel/millisecond ): <input type = "text" id = "SI" value = "30"/> <br> moving interval (unit: milliseconds ): <input type = "text" id = "T" value = "1"/> <br> half-cycle loss (speed) Energy (>-1 ): <input type = "text" id = "SL" value = "1"/> <br> distance from the start position to the central axis (unit: pixel ): <input type = "text" id = "P" value = "-1" onBlur = "Distance () "/> <br> <input type =" button "id =" stop "value =" stop now "style =" width: 100px; height: 25px; top: 220px; left: 500px; "onclick =" Stop () "/> </p> </body> </ptml>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
Here I am running my compressed version code (some cards are running on the internet). I will upload the full version and the Code with comments (which is very detailed, the first time I posted code in my blog, it was quite difficult to control! Haha !), There are also experts who don't want to laugh. I am using a very stupid method. There will be new special effects to upload in a few days (this spring is a button special effect on my webpage, my webpage has a lot of special effects. The webpage has not been completed yet. After that, I will send all the original special effects ). Because I am still studying, it may be slow to publish new special effects. Please forgive me! (Let's think about some special effects and give me some inspiration. Haha !)
Programming logic:
It mainly uses physical thinking, imagining the spring movement process, and then simulating it with If else and else if, because the action of any thing is .. so .. so you can use If else!
Source: http://www.cnblogs.com/NONE/
Package download