<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Text to Abstract Art</title>
<style>
body {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
background: #111;
color: white;
font-family: sans-serif;
}
#canvas {
width: 80vw;
height: 50vh;
background: black;
overflow: hidden;
position: relative;
}
.shape {
position: absolute;
border-radius: 50%;
opacity: 0.8;
transition: transform 1s ease-in-out, opacity 1s ease-in-out;
}
input {
margin-top: 20px;
padding: 10px;
font-size: 18px;
width: 60%;
text-align: center;
}
</style>
</head>
<body>
<div id="canvas"></div>
<input type="text" id="textInput" placeholder="Type something, anything, please!">
<script>
const canvas = document.getElementById("canvas");
const input = document.getElementById("textInput");
function generateArt(text) {
canvas.innerHTML = "";
let uniqueChars = new Set(text).size;
let textLength = text.length;
for (let i = 0; i < Math.min(textLength, 50); i++) {
let shape = document.createElement("div");
shape.classList.add("shape");
// Randomized shape properties based on text input? v I dunno a million
let size = (textLength % 50) + (Math.random() * 50);
let x = Math.random() * (canvas.clientWidth - size);
let y = Math.random() * (canvas.clientHeight - size);
let color = `hsl(${(uniqueChars * 36 + i * 10) % 360}, 80%, 60%)`;
shape.style.width = shape.style.height = `${size}px`;
shape.style.left = `${x}px`;
shape.style.top = `${y}px`;
shape.style.background = color;
// Random animation effect lets gooo just cirlces so far
shape.style.transform = `scale(${1 + Math.random()}) rotate(${Math.random() * 360}deg)`;
canvas.appendChild(shape);
}
}
input.addEventListener("input", () => generateArt(input.value));
</script>
</body>
</html>
Monday, February 3, 2025
Save this to a text doc then save it to .html then open it up and type something
Subscribe to:
Post Comments (Atom)
Current obsession
Singularly combining photography, traditional cyanotype printing processes, 3d printing, and digital maniuplation - to create singlular obj...

-
What I want to explore is how I can adapt this to other media? 3d printing? How would a heightmap in Rhino affect this? Now, I have all th...
-
Update 1: Nevermind magnets (cool though they are) - what if I just put some kind of notch thing on the sides so they dovetail together? +e...
-
Welcome To OBDF 310: STUDIO PRACTICE IN OBJECT DESIGN First post of this class! I'll start out with what I ended up with after a lot...
No comments:
Post a Comment