Skip to content

Instantly share code, notes, and snippets.

@tankred
Last active October 19, 2020 13:45
Show Gist options
  • Save tankred/9574498 to your computer and use it in GitHub Desktop.
Save tankred/9574498 to your computer and use it in GitHub Desktop.
Nine-Colors II
<canvas id="EllsworthKelly" width="650" height="650"></canvas>
<!--
HTML5 painting based on:
Artist: Ellsworth Kelly
Completion Date: 1951
Style: Color Field Painting
src: http://www.wikipaintings.org/en/ellsworth-kelly/nine-colors-1951
-->
var ctx = document.getElementsByTagName('canvas')[0].getContext('2d');
var pos=107;
var radius=pos;
var offset=3;
var arr = new Array();
arr[0]="#374DB3";
arr[1]="#D36C03";
arr[2]="#69A7CA";
arr[3]="#780F26";
arr[4]="#348374";
arr[5]="#60351D";
arr[6]="#441334";
arr[7]="#CEB841";
arr[8]="#90342B";
var c=0;
for (var i=1;i<6;i=i+2){
for (var j=1;j<6;j=j+2){
ctx.beginPath();
ctx.fillStyle = arr[c];
ctx.arc(pos*(i)+offset, pos*(j)+offset, radius, 0, Math.PI * 2, true);
ctx.fill();
ctx.closePath();
c++;
}
}
#EllsworthKelly{background:#111;}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment