xxxxxxxxxx
180
let font
let fontSize = 120
// let wordc = "c"
// let wordh = "h"
// let worda = "a"
// let wordo = "o"
// let words = "s"
let word = "chaos"
let modules=[]
let i= 1
function preload() {
font = loadFont('Raleway-Black.ttf')
}
function setup() {
createCanvas(500, 500)
noStroke()
// Load a piece of text as points.
// To make this higher resolution, supply a higher sampleFactor (default is 0.1).
//
// For example:
// textToPoints(text, 0, 0, fontSize, { sampleFactor: 5 })
//
// textFont("Raleway-Black")
// textAlign(CENTER, CENTER);
// textSize(fontSize)
// text('chaos')
// blendMode(LIGHTEST);
// var pt=points[i]
points = font.textToPoints(word, 80, 280, fontSize,{
sampleFactor: 0.3 // default is 0.1
})
// print(points)
fill(255);
// for (let pt of points) {
// ellipse(pt.x, pt.y, 2)
// pt.x = pt.x+random(-8, 8)
// pt.y = pt.y+random(-8, 8)
// }
}
function draw() {
background(50)
// sketchTitle2()
// for (let pt of points) {
// ellipse(pt.x, pt.y, 1)
// }
fill(255);
// for (let pt of points) {
// ellipse(pt.x, pt.y, 2)
// // pt.x += random(-1.2, 1.2)
// // pt.y += random(-1.2, 1.2)
// }
for (let pt of points) {
ellipse(pt.x, pt.y, 2)
pt.x = pt.x+random(-i, i)
pt.y = pt.y+random(-i, i)
// pt.x = pt.x+random(-5, 5)
// pt.y = pt.y+random(-5, 5)
}
// fill(255,200);
beginShape()
for (let pt of points) {
vertex(pt.x, pt.y)
}
endShape(CLOSE)
fill(0)
textFont("Raleway-Black")
textAlign(CENTER, CENTER);
text('"chaos"', width / 2, height / 2);
// if ((mouseX > width/2-50) && (mouseX < width/2+50) &&
// (mouseY > height/2-50) && (mouseY < height/2+50)) {
// }else{
// for (let pt of points) {
// ellipse(pt.x, pt.y, 2)
// pt.x = random(-2, 2)
// pt.y = random(-2, 2)
// }
// }
}
function mousePressed(){
i=i*2
}
function sketchTitle2() {
fill(255);
noStroke()
textFont("Raleway-Black")
textAlign(CENTER, CENTER);
noStroke()
textAlign(CENTER, CENTER); textSize(15);
text('', width/2, 30);
//text
textAlign(CENTER, CENTER); textSize(15);
text('"chaos"', width/2, height-30);
}