Skip to content

Commit ce478a8

Browse files
committed
disc creator
1 parent 8ae678b commit ce478a8

File tree

3 files changed

+49
-1
lines changed

3 files changed

+49
-1
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<style>
2+
#disc {
3+
position: absolute;
4+
top: 0;
5+
left: 0;
6+
width: 1000px;
7+
height: 1000px;
8+
}
9+
#disc > div {
10+
position: absolute;
11+
top: 500px;
12+
left: 500px;
13+
width: 340px;
14+
transform-origin: center left;
15+
}
16+
#disc > div > div {
17+
position: absolute;
18+
right: 0;
19+
transform: translateX(50%);
20+
}
21+
#template-disc {
22+
opacity: 0.2;
23+
}
24+
</style>
25+
<img id="template-disc" width="1000" src="/catch-phrase-disc-creator/template-disc.png" />
26+
27+
<div id="disc">
28+
</div>
29+
30+
<textarea id="phrases" oninput="updateDisc()"></textarea>
31+
32+
<script>
33+
// Inserts each phrase in it's own div in the #disc
34+
function updateDisc() {
35+
const phrases = document.getElementById('phrases').value;
36+
const phraseList = phrases.split('\n');
37+
const disc = document.getElementById('disc');
38+
disc.innerHTML = ''; // Clear existing content
39+
phraseList.forEach((phrase, i) => {
40+
const containerDiv = document.createElement('div');
41+
const phraseDiv = document.createElement('div');
42+
phraseDiv.textContent = phrase;
43+
containerDiv.appendChild(phraseDiv);
44+
disc.appendChild(containerDiv);
45+
// Apply a rotation to each div based on its index
46+
containerDiv.style.transform = `rotate(${i * 5 + 2}deg)`;
47+
});
48+
}
49+
</script>
501 KB
Loading

test/index.html

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)