ShineTime – A Kick

编程入门 行业动态 更新时间:2024-10-25 06:21:11

ShineTime – A <a href=https://www.elefans.com/category/jswz/34/1738728.html style=Kick"/>

ShineTime – A Kick

This week I’d like to show you how you can create a kick-ass animatedShine Effect with jQuery & CSS3and then use it to create your very own Shiny Gallery ‘ShineTime’. This effect is useful in making your user interface elements look like they’re a real polaroid photo (or made of glass) and the best part is, it’s not that difficult to achieve. I always think it’s useful to see a demo of what we’re making before we look at it, so click here to check out the livedemo.

You’ll also learn today how you can successfully use layering in your designs to give your gallery that extra bit of detail that can make it stand out from the others. Whilst I’m going to leave it to David Walsh to provide you with galleries full of Christina Ricci photos, today’s component includes a set of pictures from the movie ‘Kick-Ass’ for no other reason than because ; )

The Animated ‘Shine’ Effect

The idea behind a Shine Effect is to give your graphics the appearance of being on a glossy surface that have just had a light beam pass over them. This can make them appear to be made of glass and can increase the visual experience your end users see.

Before we get into any code, lets go through the basic concepts behind the effect. We want to pass a light-beam (in this case an image simulating a shine) past our image when the user hovers over it. Now because I wanted to style up today’s gallery so that each thumbnail appeared to float out of it’s container, the steps to achieving the below animation are as follows:

  1. Change the margins of the thumbnail element so that it floats away from it’s container
  2. Set the background-position of your “shine” graphic to be –1 * (it’s total width)
  3. Animate your background-position to value of the total width. Effectively we’re hiding the gloss off-stage and then animating it across the image.

You can see this being achieved in the diagram below.

Now, because ShineTime is going to also apply this effect to the caption holder component (see the demo), I needed to come up with a much larger shine graphic for this that cleanly executes the desired effect without being slow or making the text unreadable. Using an image about 20% longer than the container in each direction at a layer below the text made this possible.

Designing ShineTime

Graphics-wise, there are a few important things to note about ShineTime. I wanted to give this demo an extra-depth of design detail so the following techniques were applied to create the final main-photo area:

  1. CSS3is used to create the rounded-corner borders around the main container div. It is also used on the indented shadow layer (which you can see below). In order for the caption container to also fit this design spec, it’s bottom rounded corners use CSS3 to keep everything looking like it’s inside the same box.
  2. Layering is heavily used in this demo to achieve a photographic-depth effect. The choice to do this using an image rather than CSS3 was in order to preserve the effect displaying in browsers like IE6.
  3. Normally, image galleries are based on UL/LI elements which are wrapped together using jQuery & CSS to turn them into something pretty. Here, because the actual image needs to be behind a few other layers so that it can have (a) Rounded corners and (b) the photo-effect, it’s necessary for all images to be loaded using the background-image property of the ‘largephoto’ div (take a look at the HTML code to see what I’m talking about)
  4. CSS3 is finally also used on the ShineTime Header. Whilst I’ve included Cufon for a little added cleanliness to my typographic elements, in the header it’s simply used for adding an indented feel to the text to give the background that extra ‘metallic’ feel to it.

The Code

Finally, for the part you’ve been waiting for: the code.

HTML (Sample)

view plain copy to clipboard print ?
  1. <divclass="thumbnailimage">
  2. <divclass="thumb_container">
  3. <divclass="large_thumb"><imgsrc="images/thumbnails/sample1.jpg"class="large_thumb_image"alt="thumb"><imgalt=""src="images/large/sample1.jpg"class="large_image"rel="JustbecauseIcan'tcode,
  4. doesn'tmeanIcan'tkickyourass!">
  5. <divclass="large_thumb_border"></div>
  6. <divclass="large_thumb_shine"></div>
  7. </div>
  8. </div>
  9. </div>
  10. <divid="containertitle">WelcometoShineTime</div>
  11. <divclass="mainframe">

更多推荐

ShineTime – A Kick

本文发布于:2024-03-13 03:46:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1733120.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:ShineTime   Kick

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!