Segmentation Fault
Analyzing the core
  • Home
  • About

SVG experiments

Web Add comments

While someone else has javascript and canvas covered, I wanted to learn some new things about SVG. While perhaps best known for the tiger and other graphic goodness, I am not a graphics artist. So these didn’t apply to me so much. However, you can do some neat things with images in SVG that are harder/impossible to do in CSS, such as rotating images and skewing them.

So I started doing some things with SVG. One of those being something to catalog all the albums I have started amassing (I only have 460MB left of my 2GB iPod). Yes, I still do pay for music. I’m old skool like that.
You need an SVG viewer to view this image. May I recommend a plugin or a SVG enabled browser?
Not much. But it took me so long to get rotation working, mainly because of lack of good sample documentation. Though I came across some good docs, it just wasn’t enough. For example, here is the code to rorate:

rotate(angle, cx, cy)

Where angle is how much you want to rotate it by, in degrees.
cx and cy are the “offset of the current view box. If cx and cy are not present then the points are rotated around the origin” (Bystedt). Both cx and cy are optional.

Maybe an example of rotation would clarify cx and cy. Here is the first image being rotated 45° without skewing at point 0,0.
Man, another SVG image. Your really missing out
To rotate an image at the centre, cx and cy should be the distance to the centre of the image. Both on the x-axis and y-axis respectively. Imagine to my horror when the image was 50% from the left, and a 45° rotate threw it down half way across the screen. I won’t bore you with the details of how changing cx and cy confused me even more, but some samples would have helped!

Tags: seneca, svg


April 27th, 2008 |

Tags: seneca, svg


Leave a Reply

  • Pages

    • About
  • Recent Posts

    • addParser.py
    • A (Use) Case for self-signed certs
    • Now for something completely different
    • New Editor tool finally landed on AMO
    • Calvin and Hobbes
  • Tags

    editor extension fennec google chrome html5 intern json lazy mozilla personal prism python ria security seneca sleep svg tinderbox tip toronto Web wildon
  • Archives

    • November 2008
    • October 2008
    • September 2008
    • August 2008
    • July 2008
    • June 2008
    • May 2008
    • April 2008
  • Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org
  • Blogroll

    • Andrew Smith
    • Anthony Hughes
    • Michael Mullin
  • Links

    • My Gallery
    • My Repository
RSS XHTML CSS Log in
Copyright © 2008 Segmentation Fault All Rights Reserved
Wp Theme by i Software Reviews
Proudly Powered by Wordpress