xxxxxxxxxx
54
// Text Along Circle, Xin Xin, 2020
let sentence = "HELLOWORLD";
let sentenceArray = [];
let r = 30; // radius
let theta = 0;
let innerArrray = ["UMBELLAR", "MEASURES", "GODS", "EXIT", "RESOUNDS", "ACAPELLA", "NO ONE", "INTERPRETS"];
let outerArray = ["SILENCE", "SUMMER", "TIMES", "SUMMER", "ANSWERS", "EACH", "SEEN", "RED"];
function setup() {
createCanvas(1000, 1000);
// textAlign(CENTER);
textSize(18);
fill(255);
sentenceArray = sentence.split(""); // splits a string into an array of chars
print(sentenceArray);
}
function draw() {
background(185, 20, 222);
translate(width / 2, height / 2);
// for (let i = 0; i < 8; i++) {
// rotate(QUARTER_PI); // rotation for the group of letters, which affects the spacing between letters
// translate(r * sin(theta), r * cos(theta));
// tran
for (let i = 0; i < innerArrray.length; i++) {
rotate(QUARTER_PI/1.05); // rotation for the group of letters, which affects the spacing between letters
push();
// translate(r * sin(theta), r * cos(theta));
translate(r*sin(300) , r*cos(300));
rotate(PI); // rotation for individual letter
text(innerArrray[i], 0, 0);
pop();
}
for (let i = 0; i < outerArray.length; i++) {
rotate(QUARTER_PI/1.05); // rotation for the group of letters, which affects the spacing between letters
push();
// translate(r * sin(theta), r * cos(theta));
translate(90*sin(300) , 90*cos(300));
rotate(PI); // rotation for individual letter
text(outerArray[i], 0, -15);
pop();
}
}