Dev.Opera - Follow the standards, break the rulesDev.Opera - Follow the standards, break the rules

Login

Lost password?

Forums » Article Discussions

Discuss the articles posted at DevOpera

Note: You need to login to post in the forums. if you don't have an account you first need to sign up.

By MacDev_ed anchor Friday, 29. February 2008, 09:31:46

How to do photoshop-like effects in SVG

Wanna add some polish to your site, the standards way? In this article Erik shows how you can save time and money on creating graphics and effects programmatically using SVG instead of doing them all manually using Photoshop.

( Read the article )

By freedo anchor Friday, 29. February 2008, 15:33:40

avatarHey, this looks very nice!

Thanks for the inspiration, this is really a good example for intelligent use of SVG in modern web pages.

I just noticed two problems with the hover effect (Opera 9.5beta on Linux): The blue highlight ellipse isn't clipped to the button area, and it's above the text, which makes it lesser readable. (The clipping seems to work fine in rsvg, though.)

And then, normally I would use scripting for such simple mouseover effects, but declarative animation. But since Opera is the only browser with quite complete animation support, currently it may be wiser to choose scripting. However, Batik seems to have problems with you script. Maybe you could test it in Batik, too? It's currently one of the best (and strictest) SVG implementations out there, so if it runs in Batik without problems, it should run everywhere.

By MacDev_ed anchor Friday, 29. February 2008, 23:21:34

avatar@freedo:
The blue highlight is on top of the text yes, and I see now that's not how the original photoshop-version looked like. Good thing it's so easy to change that in the svg by moving the highlight to before the button text. I think I'll just leave that as an exercise. :wink:

About the clipping issue in 9.5beta/linux: we'll try to get that fixed for the final version, no worries.

Scripting allowed the svg source to stay a bit cleaner in this case IMHO, declarative animations are sometimes verbose in comparison. I prefer to use declarative animation when I can though.

I did test in Batik 1.7 before publishing the original article, and while it is indeed a very nice SVG implementation it doesn't implement some specifications, in this case the DOM Level 2 Style spec, which is used to do the hover effect. You may note that the SVG 1.1 spec requires complete support of DOM Level 2 Style, for more information see here. Anyway, sans the hover effect the testcase looked just as good in Batik 1.7 as in Opera 9.

By freedo anchor Saturday, 1. March 2008, 21:40:51

avatarThanks for the clarifications!

By MacDev_ed anchor Thursday, 13. March 2008, 08:43:21

avatarI've made two modifications in the original example:
1) Made the button text be on top of the blue hover shape
2) Added type="text/css" to the <style> element

That makes it work in FF3 nightlies, and also makes the text more readable.

By SteveD O anchor Friday, 11. April 2008, 09:57:05

avatarThough this kinda thing is nice for repetitive maintenace and/or localization, I could still do that in Photoshop and code it up in HTML/CSS faster than doing all that code. and it doesn't take long at all to make changes. you just make the changes in photoshop and save it out. how often do navigation bars change that often anyways?

i don't know. as a designer i just feel this is too much work. it's neat that you can generate so much dynamically, but to me it's still faster to do it in photoshop.

Moderators: jax | malware | mcx | operadev