Rosetta
function setup() { //colorset from Brendan Dawes
BITTERSWEET = 253, 115, 87;
BIANCA = 252, 250, 242;
ONYX = 18, 10, 13;
RICECAKE = 237, 237, 224;
createCanvas(600, 600)
rectMode(CENTER)
cols = width / 3
rows = height / 3
}
function rosette(x, y, n) {
noFill()
strokeWeight(10)
//vertical
beginShape()
vertex(0, -cols / 2)
vertex(-cols / 7.375, -cols / 2.275)
vertex(-cols / 7.375, -cols / 17.5)
endShape()
beginShape()
vertex(0, -cols / 2)
vertex(cols / 7.375, -cols / 2.275)
vertex(cols / 7.375, -cols / 17.5)
endShape()
beginShape()
vertex(-cols / 7.375, cols / 17.5)
vertex(-cols / 7.375, cols / 2.275)
vertex(0, cols / 2)
endShape()
beginShape()
vertex(cols / 7.375, cols / 17.5)
vertex(cols / 7.375, cols / 2.275)
vertex(0, cols / 2)
endShape()
//-45deg
push()
rotate(radians(-45))
//stroke(0,127,255)
beginShape()
vertex(cols / TWO_PI, -cols + (90))
//vertex( 0 , -cols/2 )
vertex(-cols / 7.375, -cols / 2.275)
vertex(-cols / 7.375, -cols / 17.5)
endShape()
beginShape()
//vertex( 0 , -cols/2 )
//vertex( -cols/7.375 , -cols+90 )
vertex(-cols / TWO_PI, -cols + (90))
vertex(cols / 7.375, -cols / 2.275)
vertex(cols / 7.375, -cols / 17.5)
endShape()
beginShape()
vertex(-cols / 7.375, cols / 17.5)
vertex(-cols / 7.375, cols / 2.275)
//vertex( 0 , cols/2 )
//vertex( cols/7.375 , cols-90 )
vertex(cols / TWO_PI, cols - (90))
endShape()
beginShape()
vertex(cols / 7.375, cols / 17.5)
vertex(cols / 7.375, cols / 2.275)
//vertex( 0 , cols/2 )
//vertex( -cols/7.375 , cols-90 )
vertex(-cols / TWO_PI, cols - (90))
endShape()
pop()
//45deg
push()
rotate(radians(45))
//stroke(0,255,127)
beginShape()
//vertex( cols/7.375 , -cols+90 )
vertex(cols / TWO_PI, -cols + (90))
//vertex( 0 , -cols/2 )
vertex(-cols / 7.375, -cols / 2.275)
vertex(-cols / 7.375, -cols / 17.5)
endShape()
beginShape()
// vertex( 0 , -cols/2 )
//vertex( -cols/7.375 , -cols+90 )
vertex(-cols / TWO_PI, -cols + (90))
vertex(cols / 7.375, -cols / 2.275)
vertex(cols / 7.375, -cols / 17.5)
endShape()
beginShape()
vertex(-cols / 7.375, cols / 17.5)
vertex(-cols / 7.375, cols / 2.275)
//vertex( 0 , cols/2 )
//vertex( cols/7.375 , cols-90 )
vertex(cols / TWO_PI, cols - (90))
endShape()
beginShape()
vertex(cols / 7.375, cols / 17.5)
vertex(cols / 7.375, cols / 2.275)
//vertex( 0 , cols/2 )
//vertex( -cols/7.375 , cols-90 )
vertex(-cols / TWO_PI, cols - (90))
endShape()
pop()
//horizontal
push()
rotate(radians(90))
beginShape()
vertex(0, -cols / 2)
vertex(-cols / 7.375, -cols / 2.275)
vertex(-cols / 7.375, -cols / 17.5)
endShape()
beginShape()
vertex(-cols / 7.375, cols / 17.5)
vertex(-cols / 7.375, cols / 2.275)
vertex(0, cols / 2)
endShape()
beginShape()
//stroke(253, 115, 87)
vertex(0, -cols / 2)
vertex(cols / 7.375, -cols / 2.275)
vertex(cols / 7.375, -cols / 17.5)
endShape()
beginShape()
vertex(0, cols / 2)
vertex(cols / 7.375, cols / 2.275)
vertex(cols / 7.375, cols / 17.5)
endShape()
pop()
}
function draw() {
translate(width / 2, height / 2)
push()
rotate(radians(23))
rotate(0)
pop()
push()
rotate(radians(-23))
rotate(0)
pop()
for (i = 0; i < 8; i++) {
push()
rotate(radians(i * (45 / 2)))
pop()
}
stroke(237, 237, 224)
rosette()
push()
translate(-cols, 0)
rosette()
translate(cols * 2, 0)
rosette()
translate(-cols, cols)
rosette()
translate(0, -cols * 2)
rosette()
translate(-cols, 0)
rosette()
translate(cols * 2, 0)
rosette()
translate(0, cols * 2)
rosette()
translate(-cols * 2, 0)
rosette()
pop()
}
function undraw() {
translate(width / 2, height / 2)
push()
rotate(radians(23))
rotate(0)
pop()
push()
rotate(radians(-23))
rotate(0)
pop()
stroke(237, 237, 224)
//strokeCap()
strokeJoin(BEVEL)
for (i = 0; i < 8; i++) {
push()
translate(-i * 100, -i * 100)
rotate(radians(i * (45 / 2)))
rosette()
pop()
}
}
A reinterpretation of an islamic star pattern