P2. JS Linear Spring (linearspring) Memo

Source: Internet
Author: User

First segment Key code:
1 var New P2. Linearspring (Holderbody, Circlebody, {2     Localanchora: [0, 0],3     Localanchorb: [0, 0],4     stiffness:100,5     damping:1, 6     restlength:1.57}); 8 world.addspring (S1);

: Here Localanchora, the concept of localanchorb is still relative to the coordinates within the respective object, and when [0,0], represents the center point of the object. By default, this coordinate is the center of the object. This coordinates indicate where one end of the spring is hooked on the object. The stiffness represents the strength of the spring. By default, it is 100. Look at the effect of the stiffness:1000, and then pull the ball, you will find the ball back and forth quickly, that means the strength of the spring is higher. Damping, which is the resistance of the spring. By default, it is 1. When the spring is stretched, the resistance of the spring to the contraction action is controlled by this property. Restlength, literally understood, is the natural stretching length when the spring relaxes. The default is the current distance between the world anchor points, which is the length of the distance between the two anchor points. Practice Source Address: https://gist.github.com/yxzblue/3a66babfb93b889f0833#file-linearspring-html p2.js v0.6.0 Package, Link:/http Pan.baidu.com/s/1mgsw7xa Password: Bj85p2.js's github address: https://github.com/schteppe/p2.js

P2. JS Linear Spring (linearspring) Memo

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.