- From: Maciej Stachowiak <mjs@apple.com>
- Date: Fri, 01 Jul 2016 17:37:22 -0700
- To: "Tab Atkins Jr." <jackalmage@gmail.com>
- Cc: Dean Jackson <dino@apple.com>, www-style list <www-style@w3.org>
- Message-id: <09FFC5F4-7C4A-47E8-B488-BDB9AE52E006@apple.com>
> > (Alternate syntax: use units for these, like `spring(2mass > 5velocity)`. Stronger connection between value and type, but also > maybe weird? Unsure.) "mass" and "velocity" aren't units, they are types of units. This would be like writing "8length" instead of "8px". Please don't make physicists cry. > > (Second alternate syntax: finally invent "named arguments" for real, > like some people have been agitating for for a while. `spring(mass: > 2; velocity: 5;)`? To be less weird we'd have then go and backport > this to other functions. Probably a decent idea? Need to noodle on > syntax more, look at several different functions that use syntax > differently. That's a more appealing syntax and makes it easier to figure out defaults. > > >> We could pick another formula that is more amenable to duration-based >> springs. >> >> However, there is some criticism against coding an animation like this >> purely on duration: >> https://medium.com/@flyosity/your-spring-animations-are-bad-and-it-s-probably-apple-s-fault-784932e51733 <https://medium.com/@flyosity/your-spring-animations-are-bad-and-it-s-probably-apple-s-fault-784932e51733> > > That criticism is geared towards a bad API design that required you to > specify a *technically redundant* duration, and if you didn't specify > what the algo would have "naturally" provided you get an > unnatural-looking result. My read is that it actually solves the spring equation in reverse and computes a stiffness and mass for the given duration. There is no stiffness or mass provided to the API, just damping (as a ratio, presumably relative to stiffness or something) and initial velocity. So the duration is not redundant. I think the reason the spring examples using the API look bad is that authors are likely to severely underestimate the duration required for a comfortable looking bounce, thus resulting in springs with crazy high stiffness which look awkward even though they are technically correct. Regards, Maciej
Received on Saturday, 2 July 2016 00:37:59 UTC