Artists
Translations
v2n2_gyrating_forms
Translated by
Benjamin Fox
Based on:
Gyrating Forms
by
James R Warner
Category:
direct
Play
Stop
/* Part of the ReCode Project (http://recodeproject.com) Based on "Gyrating Forms" by James R Warner Originally published in "Computer Graphics and Art" v2n2, 1977 Copyright (c) 2013 Benjamin Fox - OSI/MIT license (http://recodeproject/license). */ let points;//container for the points generated elsewhere containing our shape let sh_w, sh_h;//width and height of our shape let start_angle; let generations, deg; function setup(){ createCanvas(900, 650); background(255); generations = 50;//how many times we want to draw the shape deg = 0; start_angle = -56;//degrees of rotation we want to start drawing from sh_w = 0; sh_h = 0; //these points were generated by another sketch, tracing clicks on top of the template shape image to create an array of points to draw //this could potentially be substituted by an SVG shape or PShape description (any geometery will do) points = []; points.push(createVector(19.0, 3.0)); points.push(createVector(67.0, 3.0)); points.push(createVector(52.0, 54.0)); points.push(createVector(153.0, 137.0)); points.push(createVector(234.0, 152.0)); points.push(createVector(234.0, 119.0)); points.push(createVector(268.0, 85.0)); points.push(createVector(299.0, 85.0)); points.push(createVector(318.0, 103.0)); points.push(createVector(333.0, 151.0)); points.push(createVector(366.0, 170.0)); points.push(createVector(500.0, 169.0)); points.push(createVector(547.0, 202.0)); points.push(createVector(515.0, 235.0)); points.push(createVector(483.0, 219.0)); points.push(createVector(385.0, 238.0)); points.push(createVector(401.0, 322.0)); points.push(createVector(517.0, 355.0)); points.push(createVector(616.0, 471.0)); points.push(createVector(582.0, 504.0)); points.push(createVector(484.0, 404.0)); points.push(createVector(350.0, 389.0)); points.push(createVector(269.0, 440.0)); points.push(createVector(252.0, 507.0)); points.push(createVector(203.0, 507.0)); points.push(createVector(219.0, 405.0)); points.push(createVector(252.0, 338.0)); points.push(createVector(187.0, 221.0)); points.push(createVector(135.0, 204.0)); points.push(createVector(1.0, 69.0)); points.push(createVector(1.0, 37.0)); for (let p of points) { if (p.x > sh_w) { sh_w = p.x; } if (p.y > sh_h) { sh_h = p.y; } } } function draw(){ if (deg < generations) { stroke(0); strokeWeight(1); push(); translate(width/2, height/2);//center stage rotate(radians(start_angle + deg));//rotate it translate(-(sh_w / 2), -(sh_h / 2));//reset where we start to draw our shaoe so it's central let lp = points[0];//initialize last point as the first in the arrayList let sz = points.length - 1;//size of the arrayList for (let i = sz; i >= 0; i--) { let p = points[i]; line(lp.x, lp.y, p.x, p.y); lp = p; } pop(); deg++; } }