Search for '{{search_term}}'

SVG Square

CMOS is the Code-Maven Open Source podcast that also includes video interviews. Subscribe to this feed RSS feed with your Podcast listener app or via iTunes iTunes.

This is part of the SVG Tutorial and exercises drawing square in SVG.

Actually a square is just a rectangular where all the 4 sides are the same length, but the color is much nicer here.

examples/js/svg_square.js

function draw_square() {
    var draw = SVG('square_1');
    draw.size(120, 120);
    var square = draw.rect(100, 100);
    square.attr({ fill: '#f06' });
}

draw_square()

Comments

In the comments, please wrap your code snippets within <pre> </pre> tags and use spaces for indentation.
comments powered by Disqus