Is it possible to transform a div into this kind of shape then fill it with an image? Or better transform an image to that shape? Both with CSS or Javascript.
Then arrange multiple of them in this manner
I intend to group the shapes into several rings as per the second picture. As for the pictures, it will be dynamic, so can’t really pre-cut them.
*Edit: I found out the effect I actually want. It is actually masking. In webkit, this css property: -webkit-mask-box-image works well (I can use .png image too for the mask), but when I tried masking for firefox (using .svg file generated by Illustrator), it doesn’t seem to work. The same .svg file works in Chrome using -webkit-mask-box-image css property
Yes, it is possible. Even without using any JavaScript or browser specific properties.
demo
I’ve tested it and it works on all current versions of Chrome, IE, FF, Opera, Safari (on Windows 7).
The idea is to have multiple wheels with slices of different angles (get the angle using a skew transform; the slices are also rotated using a rotate transform). The inner wheels cover the the central part of the outer ones.
The version I’ve made is a pretty simple one, with two wheels, 8 images for the inner wheel (that means each slice of the inner wheel has 360°/8 = 45°) and 12 images for the outer wheel (=> each slice of the outer one has 360°/12 = 30°).
Relevant HTML:
Relevant CSS:
Another slightly different enhanced version:
demo