. A computer-based method for creating the effects seen on a computer monitor as have been described heretofore, comprising the following:
a. A list of spring nodes is created, one for each object or chain segment being represented on the monitor, plus a termination node. The position of the first (primary) node is assigned to match the movement of the object being directly acted upon by the input (variable) vector. Initial positions of nodes following the primary are determined by applying each node's velocity to its position. The relative angle between nodes is restricted and each node is repositioned to be a constant distance from the preceding node. The difference between the initial position and final position is multiplied by a mass factor (best mode of 0.05 to 0.1, with 0.10 applied to the attached embodiment) to the velocity of each node. Changes are applied using a fixed timestep to keep the simulation stable and consistent regardless of extremes or variations in the display framerate. The objects are positioned at the corresponding spring node, offset by an anchor position, and oriented along the angle to the following node. If the first card was not originally oriented along the gravity vector, it is rotated into line over several frames.
b. Initialization: If two or more objects are supplied, the spring length is determined from the distance between the first two cards; otherwise a default value of at least one pixel is used, with a best mode of 20 pixels, more or less. An anchor offset where each card is attached to the spring node is determined from the card height and the spring length. A list is built of spring nodes, one for each object plus one additional node at the bottom (terminal node). Beginning with the position of the first object, each spring node is initialized to be positioned below the initial position, spaced by the spring length, and assigned a velocity of zero.
c. Update timing. In each subsequent frame, the spring system is updated. The time since the previous frame is divided into fixed-length timesteps. (The best mode is between 10 and 80 frames per second, with 20 frames per second used in the attached embodiment.) Any remaining time is saved and applied to the next frame. Any movement of the first card since the previous frame is divided equally among the available timesteps.
d. Node updating.
i. The drag vector is found by subtracting the first node's position from the position of the first object;
ii. Velocity increase from ‘gravity’ (the fixed vector that aligns the string at rest) is determined by multiplying the gravity vector by the timestep. If the angle of the drag vector is close to the gravity vector, than gravity velocity is enhanced by the drag movement. (The best mode is no more than 30 degrees, and 30 degrees is used in the attached embodiment.)
iii. For each node after the first, prior velocity is dampened by multiplying prior velocity by a constant of less than 1.0. The best mode is near 1, with the value used in the attached embodiment being 0.9.
iv. Acceleration due to gravity is applied to the velocity;
v. Velocity is applied to the node's position; and
vi. A copy of the position determined by velocity alone is saved.
e. Angle restriction. For each node, from the primary to the end:
i. The direction of the vector from the previous node (or to gravity if it's the first node) is determined;
ii. The angle between the two vectors is found, clamping to (best mode) +/−90 degrees;
iii. The angle range is mapped onto the angle limit such that a (best mode) angle of 90 degrees becomes an angle of limit;
iv. The next node is repositioned relative to the current node using the adjusted angle.
f. Spring length restriction. For each node, starting with the first, the vector is determined to the next node, the vector is adjusted so length is equal to the spring length, and the node is positioned relative to the current node offset by the adjusted vector.
g. Momentum. For each node, starting with the first:
i. Determine movement vector between fmal position and position saved after applying gravity;
ii. Determine acceleration by dividing movement (velocity over this tic) by a mass value for the node. The best mode is between 1 and 10;
iii. Clamp acceleration to a maximum value, whose best mode is near 3.
iv. Apply acceleration to node's velocity;
v. Snap velocity to zero if it is close. The best mode definition of ‘close’ is less than or equal to value between zero and one, with a maximum of 0.1 being used in this embodiment.
h. Object orientation. For each object:
i. Determine unit direction vector from object's spring node to the next node;
ii. Scale the vector by the anchor offset;
iii. Add the vector to the node position to get the object position;
iv. Rotate the object by the angle between the direction vector and zero degrees.
v. In certain applications a first object or single object may have an orientation other than along the gravity vector; if so upon operation of this sequence it is reoriented to ‘up and down’ over a short period of time. The best mode as applied in the attached embodiment is 180 degrees per second.