File tree Expand file tree Collapse file tree 3 files changed +49
-1
lines changed
catch-phrase-disc-creator Expand file tree Collapse file tree 3 files changed +49
-1
lines changed Original file line number Diff line number Diff line change 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 >
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments