PNG Masking: How to Dynamically Shape Any Image on Your Website
wegraphics.net
wegraphics.net
It would be more appropriate, and less flashy, to call this PNG matting, because it's far more analogous to cutting a matte (overlaying a paper stock frame over your artwork to shape it's borders) than it is to an actual mask (using an overlaid shape to actually define a new transparent alpha channel for your image)
Webkit's actual masking is considerably more flexible. For instance, you can use one image as a mask, then color it (by setting the background color) to whatever you want… then varying the opacity… and it doesn't only work on solid backgrounds. (This is PERFECT for close buttons on your notifications, if you use e.g. green for success and red for failure, and now you don’t need to fire up an image editor when you tweak the color palette or add another class of notification.)
Of course, it’s quite limited in cross-browser applicability. http://caniuse.com/#feat=css-masks
Can anyone reply here and elaborate on how exactly that "zoom" effect was made, because it's awesome, and DISQUS is the only place I've seen it. I have made a similar effect at http://myownstream.com and http://www.fotomozo.com/gallery?name=out4c2df5372f234.png but without the round lens.
To answer the question: it's done by having a 120px square div that:
* Has the full "zoomed" image as the background: http://mediacdn.disqus.com/1318540955/img/marketing/homepage...
* Has a thick white border, 120px border-radius and a box-shadow applied.
* Is absolutely positioned, with its top and left being controlled by javascript.
Also I think there is one more factor * The background position is probably being controlled by javascript as well
border-radius will work on Firefox and Webkit (but you'd best include the -moz and -webkit versions as well, for older versions that don't pay attention to the plain attribute).
It's a bit tougher with IE. IE7 and IE8 don't support border-radius, but support can be faked with something like http://css3pie.com/ or http://fetchak.com/ie-css3/
- There was an element with background-image being a PNG with solid-colored background and transparent cut-out of a logo.
- background-color CSS property was animated with CSS transitions and jQuery fallback.
(Click the carousel, and watch the FOX8 logo up top-left. In this case it's just a clear window to the large background beneath it, but it's the same idea.)
clip: rect(t,r,b,l);
works well. I've used it to create a sort of "expand/contract" effect. But you can use it for masking as well (true masking, the background behind it shines through).