In the latest Material Design documentation (https://www.google.com/design/spec/what-is-material/elevation-shadows.html#elevation-shadows-elevation-android-) an exhaustive set of UI elements are referenced with their respective elevation (z-index in dp). For example a switch is elevated by 1dp, while a dialog is elevated by 24dp. Currently Google's list of UI elements uses 10 different elevation levels. Since the elevation decides the shadow of the element, we'll need 10 different shadows. And that's where I'm lost.
How do you calculate/deduce the right shadow values (color, x-offset, y-offset, blur, spread) for each elevation level?
I've found different sources that have calculated shadow values for 5 different elevations (https://news.layervault.com/stories/42319-calculating-shadow-values-for-material-design). However, 5 elevation steps is not enough, nor do they give an explanation as to how they got to these respective values.
Got a good news! I got all the shadow depths from depth-1 to depth-24. I got this from Angular Material. Hope this would help you.
.md-whiteframe-1dp {
box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.2),
0px 1px 1px 0px rgba(0, 0, 0, 0.14),
0px 2px 1px -1px rgba(0, 0, 0, 0.12); }
.md-whiteframe-2dp {
box-shadow: 0px 1px 5px 0px rgba(0, 0, 0, 0.2),
0px 2px 2px 0px rgba(0, 0, 0, 0.14),
0px 3px 1px -2px rgba(0, 0, 0, 0.12); }
.md-whiteframe-3dp {
box-shadow:0px 1px 8px 0px rgba(0, 0, 0, 0.2),
0px 3px 4px 0px rgba(0, 0, 0, 0.14),
0px 3px 3px -2px rgba(0, 0, 0, 0.12); }
.md-whiteframe-4dp {
box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2),
0px 4px 5px 0px rgba(0, 0, 0, 0.14),
0px 1px 10px 0px rgba(0, 0, 0, 0.12); }
.md-whiteframe-5dp {
box-shadow: 0px 3px 5px -1px rgba(0, 0, 0, 0.2),
0px 5px 8px 0px rgba(0, 0, 0, 0.14),
0px 1px 14px 0px rgba(0, 0, 0, 0.12); }
.md-whiteframe-6dp {
box-shadow: 0px 3px 5px -1px rgba(0, 0, 0, 0.2),
0px 6px 10px 0px rgba(0, 0, 0, 0.14),
0px 1px 18px 0px rgba(0, 0, 0, 0.12); }
.md-whiteframe-7dp {
box-shadow: 0px 4px 5px -2px rgba(0, 0, 0, 0.2),
0px 7px 10px 1px rgba(0, 0, 0, 0.14),
0px 2px 16px 1px rgba(0, 0, 0, 0.12); }
.md-whiteframe-8dp {
box-shadow: 0px 5px 5px -3px rgba(0, 0, 0, 0.2),
0px 8px 10px 1px rgba(0, 0, 0, 0.14),
0px 3px 14px 2px rgba(0, 0, 0, 0.12); }
.md-whiteframe-9dp {
box-shadow: 0px 5px 6px -3px rgba(0, 0, 0, 0.2),
0px 9px 12px 1px rgba(0, 0, 0, 0.14),
0px 3px 16px 2px rgba(0, 0, 0, 0.12); }
.md-whiteframe-10dp {
box-shadow: 0px 6px 6px -3px rgba(0, 0, 0, 0.2),
0px 10px 14px 1px rgba(0, 0, 0, 0.14),
0px 4px 18px 3px rgba(0, 0, 0, 0.12); }
.md-whiteframe-11dp {
box-shadow: 0px 6px 7px -4px rgba(0, 0, 0, 0.2),
0px 11px 15px 1px rgba(0, 0, 0, 0.14),
0px 4px 20px 3px rgba(0, 0, 0, 0.12); }
.md-whiteframe-12dp {
box-shadow: 0px 7px 8px -4px rgba(0, 0, 0, 0.2),
0px 12px 17px 2px rgba(0, 0, 0, 0.14),
0px 5px 22px 4px rgba(0, 0, 0, 0.12); }
.md-whiteframe-13dp {
box-shadow: 0px 7px 8px -4px rgba(0, 0, 0, 0.2),
0px 13px 19px 2px rgba(0, 0, 0, 0.14),
0px 5px 24px 4px rgba(0, 0, 0, 0.12); }
.md-whiteframe-14dp {
box-shadow: 0px 7px 9px -4px rgba(0, 0, 0, 0.2),
0px 14px 21px 2px rgba(0, 0, 0, 0.14),
0px 5px 26px 4px rgba(0, 0, 0, 0.12); }
.md-whiteframe-15dp {
box-shadow: 0px 8px 9px -5px rgba(0, 0, 0, 0.2),
0px 15px 22px 2px rgba(0, 0, 0, 0.14),
0px 6px 28px 5px rgba(0, 0, 0, 0.12); }
.md-whiteframe-16dp {
box-shadow: 0px 8px 10px -5px rgba(0, 0, 0, 0.2),
0px 16px 24px 2px rgba(0, 0, 0, 0.14),
0px 6px 30px 5px rgba(0, 0, 0, 0.12); }
.md-whiteframe-17dp {
box-shadow: 0px 8px 11px -5px rgba(0, 0, 0, 0.2),
0px 17px 26px 2px rgba(0, 0, 0, 0.14),
0px 6px 32px 5px rgba(0, 0, 0, 0.12); }
.md-whiteframe-18dp {
box-shadow: 0px 9px 11px -5px rgba(0, 0, 0, 0.2),
0px 18px 28px 2px rgba(0, 0, 0, 0.14),
0px 7px 34px 6px rgba(0, 0, 0, 0.12); }
.md-whiteframe-19dp {
box-shadow: 0px 9px 12px -6px rgba(0, 0, 0, 0.2),
0px 19px 29px 2px rgba(0, 0, 0, 0.14),
0px 7px 36px 6px rgba(0, 0, 0, 0.12); }
.md-whiteframe-20dp {
box-shadow: 0px 10px 13px -6px rgba(0, 0, 0, 0.2),
0px 20px 31px 3px rgba(0, 0, 0, 0.14),
0px 8px 38px 7px rgba(0, 0, 0, 0.12); }
.md-whiteframe-21dp {
box-shadow: 0px 10px 13px -6px rgba(0, 0, 0, 0.2),
0px 21px 33px 3px rgba(0, 0, 0, 0.14),
0px 8px 40px 7px rgba(0, 0, 0, 0.12); }
.md-whiteframe-22dp {
box-shadow: 0px 10px 14px -6px rgba(0, 0, 0, 0.2),
0px 22px 35px 3px rgba(0, 0, 0, 0.14),
0px 8px 42px 7px rgba(0, 0, 0, 0.12); }
.md-whiteframe-23dp {
box-shadow: 0px 11px 14px -7px rgba(0, 0, 0, 0.2),
0px 23px 36px 3px rgba(0, 0, 0, 0.14),
0px 9px 44px 8px rgba(0, 0, 0, 0.12); }
.md-whiteframe-24dp {
box-shadow: 0px 11px 15px -7px rgba(0, 0, 0, 0.2),
0px 24px 38px 3px rgba(0, 0, 0, 0.14),
0px 9px 46px 8px rgba(0, 0, 0, 0.12); }