Search for '{{search_term}}'

Flag of Greenland in SVG

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 the flag of Greenland in SVG.

According to the Wikipedia the flag of Greenland is from two colors: white and red (PMS 186C). The size is 18:12 parts. The disk is 8 parts in diameter and its center is 7 parts from one side.

function flag_of_greenland() {
    var draw = SVG('flag_of_greenland');
    var width = 300;
    var height = 200;
    draw.size(width+2, height+2);
    var background = draw.rect(width+2, height+2).attr({ fill: '#FFF' }).stroke({ width: 1 }); //.opacity(0);

    var circle1 =*height/12).cx(1+7*width/18).cy(1+height/2).fill('#FFF');
    var circle2 =*height/12).cx(1+7*width/18).cy(1+height/2).fill('#FFF');
    var red = '#c8102e';
    draw.rect(width, height/2).fill('#FFF').dx(1).dy(1);
    draw.rect(width, height/2).fill(red).dy(height/2).dx(1).dy(1);
    draw.rect(width, height).maskWith(circle1).fill(red);
    draw.rect(width, height).dy(height/2).maskWith(circle2).fill('#FFF');



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