vawe snappy
indicator() gives this spring to the edge of a moving indicator that leads the move. Stiffness 400, damping 32 and mass 1 give a damping ratio of 0.8, so the spring is underdamped. It settles to within 0.1% in 0.425 s. It passes the end value by up to 1.5% at 0.262 s and crosses it 1 time.
Demo
Both boxes take 0.425 s. Playing at 0.5× speed.
Your system asks for reduced motion, so nothing plays. The chart shows the whole move.
Code
A spring has no fixed duration, so the CSS takes the settle time (425 ms) and a linear() string that follows the spring.
transition: translate 425ms linear(0, 0.0053, 0.0201, 0.0428, 0.0719, 0.106, 0.1441, 0.1851, 0.2281, 0.2724, 0.3173, 0.3623, 0.4069, 0.4507, 0.4933, 0.5345, 0.5741, 0.6119, 0.6478, 0.6818, 0.7137, 0.7437, 0.7716, 0.7975, 0.8215, 0.8435, 0.8638, 0.8823, 0.8991, 0.9143, 0.9281, 0.9404, 0.9514, 0.9613, 0.9699, 0.9776, 0.9842, 0.99, 0.995, 0.9993, 1.0029, 1.0059, 1.0084, 1.0104, 1.012, 1.0132, 1.0141, 1.0147, 1.015, 1.0152, 1.0151, 1.0149, 1.0146, 1.0142, 1.0137, 1.0131, 1.0125, 1.0119, 1.0112, 1.0105, 1.0099, 1.0092, 1.0085, 1.0079, 1.0072, 1.0066, 1.006, 1.0055, 1.005, 1.0045, 1.004, 1.0036, 1.0032, 1.0028, 1.0025, 1.0021, 1.0019, 1.0016, 1.0014, 1.0011, 1);el.animate({ translate: ['0 0', '240px 0'] }, { duration: 425, easing: 'linear(0, 0.0053, 0.0201, 0.0428, 0.0719, 0.106, 0.1441, 0.1851, 0.2281, 0.2724, 0.3173, 0.3623, 0.4069, 0.4507, 0.4933, 0.5345, 0.5741, 0.6119, 0.6478, 0.6818, 0.7137, 0.7437, 0.7716, 0.7975, 0.8215, 0.8435, 0.8638, 0.8823, 0.8991, 0.9143, 0.9281, 0.9404, 0.9514, 0.9613, 0.9699, 0.9776, 0.9842, 0.99, 0.995, 0.9993, 1.0029, 1.0059, 1.0084, 1.0104, 1.012, 1.0132, 1.0141, 1.0147, 1.015, 1.0152, 1.0151, 1.0149, 1.0146, 1.0142, 1.0137, 1.0131, 1.0125, 1.0119, 1.0112, 1.0105, 1.0099, 1.0092, 1.0085, 1.0079, 1.0072, 1.0066, 1.006, 1.0055, 1.005, 1.0045, 1.004, 1.0036, 1.0032, 1.0028, 1.0025, 1.0021, 1.0019, 1.0016, 1.0014, 1.0011, 1)', fill: 'both' });import { SPRINGS, spring, springDuration, springLinear } from '../../core/motion/springs.js';
const { k, d } = SPRINGS.snappy;
// per-frame code (window.seek, vawe.onFrame): t is seconds since the move starts
const x = 240 * spring(t, k, d);
// CSS and Web Animations: 425 ms, the linear() string above
el.animate(
{ translate: ['0 0', '240px 0'] },
{ duration: springDuration(k, d) * 1000, easing: springLinear(k, d), fill: 'both' },
);Numbers
- Stiffness
- 400k, with mass 1
- Damping
- 32d, with mass 1
- Damping ratio
- 0.8underdamped
- Settle time
- 0.425 swithin 0.1% of the end
- Overshoot
- 1.5%peak at 0.262 s
- Crosses the end
- 1time
- 50% of travel
- 0.076 s18% of the settle time
- 90% of travel
- 0.15 s35% of the settle time
- Natural frequency
- 20 rad/ssqrt(k)
- Ring period
- 0.524 sone swing of the overshoot
- Peak speed
- 3.61xtimes the average speed
- linear() points
- 81within 0.12% of travel
Computed with spring() and springDuration() from core/motion/springs.js. The settle time is the last moment the spring is more than 0.1% away from the end value; a library stops its own spring by its own rest thresholds, so its clock can run shorter.
Source of the numbers
| vawe house springs | core/motion/springs.js |
| SPRINGS.snappy = { k: 400, d: 32 } | SPRINGS.snappy |
These numbers are used as they are.
Related springs
The four closest curves in this set, by the average gap between the two springs over their first seconds. A gap of 0.01 is invisible; 0.1 is a different feel.