3 ms·
I wouldn't be so fast in dismissing it, I just checked and it actually does more than simply putting an image over another: The cross-fade function correctly ha
by elisee 15y ago
I wouldn't be so fast in dismissing it, I just checked and it actually does more than simply putting an image over another: The cross-fade function correctly handles opacity and different image sizes. Plus it allows for easy use with CSS transitions.
"the start image has a global alpha applied to it equal to (1-p), the end image has a global alpha applied to it equal to p, and the end image is then composited over the start image with the source-over operation." (see http://www.w3.org/TR/2011/WD-css3-images-20110217/#cross-fade-function http://www.w3.org/TR/2011/WD-css3-images-20110217/#cross-fad...)
There are many people working on the Web specs from various groups, and they are very critical. Anything that's added to a draft will undergo a lot of review so you'd be hard pressed to find something glaringly useless.
- jacobolus 15y agoAs specced, that’s actually incorrect then. The porter duff “over” operation is identical to what’s used in browsers for regular painting of semitransparent layers (or as another example, Photoshop’s “normal blend mode”). If the below pixel A is entirely opaque, and the above pixel B has opacity P, then the color of each pixel can be computed as (1 - P) * A + P * B. If however you apply a global alpha to the below image beforehand, you get something that isn’t a cross-fade at all, and in fact isn’t even fully opaque. [edit: When I think about this a bit more, there is one time when cross-fade is useful: For cross-fading between two semitransparent images. In that case though, what’s wanted is not really a compositing operation at all, but rather a straight linear interpolation between the respective RGBA components of the two images.] I don’t at all believe that people working on the color and graphics aspects of web specs are sufficiently critical. In general, those aspects have been quite under-specced, and browser implementations have been incomplete and buggy. Things are improving little by little, but to take one example, there is still no proper color management of CSS/HTML colors in any browser except Firefox, and I believe it’s still turned off by default there.