xxxxxxxxxx
36
// hello world vortex1, xin xin, 2020
let sentence = "HELLOWORLD";
let sentenceArray = [];
let r = 100;
let theta = 0;
function setup() {
createCanvas(400, 400);
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 < sentenceArray.length; i++) {
rotate(QUARTER_PI/1.25); // rotation for the group of letters, which affects the spacing between letters
push();
translate(r * sin(theta), r * cos(theta));
// rotate(theta); // rotation for individual letter
for (let j = -80; j<=80; j+=20){
// rotate(theta);
text(sentenceArray[i], 0, j);
}
pop();
theta -= 0.001;
}
}