I am creating a bookbook library with books being dragged between shelves.
Applying box-shadowto books made them a little more realistic, but I wondered if I could continue and dynamically calculate the values box-shadowfor each book by its position relative to one selected "light source point", for example, in a game I’ll make an engine.
Thus, if we select the upper center point for the light source, there will be a lower left shadow at the bottom left and a lower right right shadow. Books below will have shadows of greater height, etc. We may need to indicate the depth (z-coordinate) for the light source, as well as its position.
While it box-shadowdoes not allow complex realistic shadows, I suspect that it would be more than enough to adjust the size and angle of the shadow with respect to their position for rectangular objects such as books to make them much more realistic.
Has anyone already studied the implementation of this in JavaScript? Do you know of any open source libraries that calculate values box-shadowfor a specific point in a light source? If not, is the idea inherently erroneous in some way that I did not think about, or is it that no one has yet tried to do this?
source
share