JavaScript High Simulation controllable spring vibrator implementation code

Source: Internet
Author: User

<! 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.