In Firefox, everything is hardware-accelerated. And the `will-change` property is largely obsolete. (I personally wish they had stuck to the old translateZ(0) hack which was obviously a hack rather than defining will-change, since WebRender—what lets Firefox do all the rendering on the GPU—was already well underway and had demonstrated that something like will-change wasn’t necessary, though it was still a few more years before it was stabilised in Firefox.)
(I haven’t the foggiest idea and my guess is wild rather than educated. I would like to be informed.)
The MDN guidance says not to use it unless absolutely necessary, which I agree with - but it was added to solve a real problem on certain browser engines (and the problem can be way worse on mobile.)
I hadn’t considered the idea of colour matching to simulate raytracing. It looks great, but I’m not sure when I’d have a product to work on which would be complimented by this treatment. Maybe I work on boring stuff. Perhaps if it was done with enough subtlety I could get away with it.
I also wonder if it could become troublesome if you had nested ColourWrapper components. I suppose the most recent wrapper would take precedence, or it could be designed as such. Maybe I’ll give it a shot.
Rando Dev: "OMG CSS!"
Me: "Bro if you just want to get the job done there's no shame in picking a CSS framework and getting it out the door. It will look nice and you're good to go."
Rando Dev: "Yeah but then I wanted to tweak this and then I had to tweak this other thing and ..."
Me: "Whose fault is that now?"
You really don't need to get into the nitty gritty to do just fine in CSS land.
The amount of give and take and work that goes into a good CSS framework is shockingly high / it's great that it is done for you. Be aware of that work if you decide to get into the details....
It helps to think of it as an art.
If you have the time to flesh it out, then enjoy the slow process.
I find the work is more rewarding that way.
Yet his own site style is totally flat?
Is this still the case? Windows used to have an almost 45° lighting angle, but more recently (MacOS, Material Design) the more common case is the light source shining from the top.
Top-left was used in the past because the only lighting hints was the edge colours, and this looks weird with a light that is directly above, so typically a 45-degree light was assumed.
In modern design, there is very little edge colouring used, and instead the light determines only shadow positioning. And shadows look perfectly fine with a light positioned directly above. This placement feels a bit more natural, as it doesn't introduce an arbitrary sideways bias.
The use of bevels has similar attributes to the edge-highlights of win 95, where putting the light from the top can make the left/right edges indistinct.
However just beware that there can be a decent performance hit from having a lot of box-shadows.
Are there any post processing libraries that can add this? It would be super interesting to treat elements on the page in 3 dimensions
Arguably what's missing is the ability to use blend modes with shadows, so that you don't need to explicitly know anything about the elements that the shadows are rendered on.
Edit: Found a Stackoverflow answer that shows a way to somewhat emulate this using a pseudo element: https://stackoverflow.com/questions/52838406/apply-blend-mod...
First, the width of the blurred region (penumbra). Imagine putting a camera on the ground and pointing it at the sun. By moving the camera in and out of shadow, it can see more or less of the sun. Intuitively we know that the higher the box is, the bigger the penumbra. The sun has an apparent size of .53°, and so does the region of partial shadow descending from the edge of the box. Some trigonometry later, and The ratio of the width of the penumbra to the elevation of the box is .00925 or about 1%
Next, we can calculate what portion of the sun is visible from the penumbra. The amount of sun visible is a portion of a circle, so we do an integral of a circle function and hoo boy would that be a pain to type on mobile. The graph is sort of a `smoothstep` shape, but is very close to linear
"Layered shadows are undeniably beautiful, but they do come with a cost. If we layer 5 shadows, our device has to do 5x more work!
This isn't as much of an issue on modern hardware, but it can slow rendering down on older inexpensive mobile devices."
5x more work is always 5x more work. Can we just stop downplaying it?
I was taught to put my black paint away and never ever use it! You really don't need it (unless you want to paint something that is actually black).
If I'm painting a purple sphere, then the cast shadow will be a much darker value of purple.
TypeError: null is not an object (evaluating 'e.current.getBoundingClientRect')
Gotta love React, TypeScript and all this wonderful modern frontend stack.
It might be because using a single, somewhat hard, black colored box-shadow is the most physically realistic option presented for a single distant light source. Adding more shadows of different radii at the same angle certainly does not approximate raytracing and give a more physically accurate result. In fact the lighting setup you would need to achieve that effect in real life would be very awkward, a set collinear lights of increasing size. Also, black is close to the best color to blend with for shadows, because it will lower the intensity of each color channel in roughly the same proportion. It won't give exact results unless you blend in sRGB space, but neither will any color blend, and black is probably the best approximation.
And two of his demos are very misleading. The majority of the 3D effect in the reveal demo comes from the actual 3D effect. Before sliding the slider, I couldn't judge the depths at all. And the elevation demo looks good, but I think much of the effect is from the size of the div increasing. If the purpose of the demo is to show the effect of shadow sharpness on perceived depth, it shouldn't confound it with another variable.
Perhaps the most egregious is your position on black shadows being the best and physically most realistic color to blend with, when in reality pure black doesn't exist in nature almost at all, it's just how our brains process things and if you actually use pure black then things will look subtly wrong--I know because I used to do that and learning to stay away from black where possible after taking a basic design course was one of the things that best improved the feel of my designs. Like, there's decades of research in the arts, sciences, and design community about this! It works for a reason.
For the sake of brevity, I'll leave this blog post here that explains it better and more in depth: https://ianstormtaylor.com/design-tip-never-use-black/
I'm quite confident of the first claim. You're contest of my second claim makes me think I was unclear. I don't suggest using black at 100% opacity as a shadow color. Instead, The shadow should be black with some fractional opacity, so that the background color is blended with black. The result of blending with black will not be pure black, but instead a good approximation of less intense light of the same color.
I also recognize that it's true that designers often use more saturated colors as the colors get darker, to good effect. But in the case of the shadows presented in the FA, I don't think it looks good, and whether it looks good or not, to claim it's inspired by physical realism is wrong.
The link above also has an example of the use of multiple shadows to create a more naturalistic feel, namely that in the real world we are accustomed to, one source of light creates multiple kinds of shadows because of reflections from clouds, objects, etc.
This is all linked to physical realism, to help carry over our expectations of what the world looks like into a (in this case) digital space.
And most website lack more important features than shadows even premium brands. Sometimes premium brands in particular value looks over function.
Having sat through quite a lot of end-user sessions, I would make three points:
1. users do often notice these differences subconsciously, even if they say they don’t. Say “which do you prefer” and they’ll tell you the one with the nicer shadow (for example) even if they can’t articulate why.
2. When a site is more aesthetically pleasing, users report greater satisfaction with the product and find it more usable. Of course, there’s diminishing returns here, but premium brands may get more returns on these subtle extras.
3. Developers tend to prefer sparse, lo-fi designs more than non-developers.
That’s how. I guess it’s time to tell these guys what they were missing all these years.
/* https://www.apple.com/store */
box-shadow: 2px 4px 12px rgb(0 0 0 / 8%);
PS. And gucci not having an https certificate is another example how "premium brands" often have completely unusable or simply non-functioning sites. Still sells.
For those that do have data, they’ve decided spending millions on it is worth it.
Much of the article might not be exactly “business value focused” but neither are the technical deep dives of database systems, though you’d never hear this kind of comment on that kind of post.
tl;dr: it’s someone nerding out a bit, it doesn’t need to create “business value”