Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

Style up a radio button group template to better communicate states

Scott Petrovic0abc6b0d5904
diff --git a/src/index.html b/src/index.html
index 02fe62f..58c43ee 100644
--- a/src/index.html
+++ b/src/index.html
@@ -10,6 +10,7 @@
<body style="margin: 0">
<script type="module" src="./script.ts"></script>
<link href="./styles.css" rel="stylesheet" crossorigin="anonymous" />
+ <link rel="stylesheet" href="./radio-button-group.css" crossorigin="anonymous" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0" />
@@ -132,11 +133,27 @@
<img src="images/icons/tool-move.svg" alt="Translate" width="20" height="20" title="translate" />
</button>
<button id="rotate-mode-button" class="secondary-button">
- <img src="images/icons/tool-rotate.svg" alt="Translate" width="20" height="20" title="translate" />
+ <img src="images/icons/tool-rotate.svg" alt="Rotate" width="20" height="20" title="rotate" />
</button>
</span>
</p>
+
+ <fieldset>
+ <div class="toggle">
+ <input type="radio" name="transform-control-type" value="translate" id="transform-translate" checked="checked" />
+ <label for="transform-translate">
+ <img src="images/icons/tool-move.svg" alt="Translate" width="20" height="20" title="translate" />
+ </label>
+ <input type="radio" name="transform-control-type" value="rotation" id="transform-rotate" />
+ <label for="transform-rotate">
+ <img src="images/icons/tool-rotate.svg" alt="Rotate" width="20" height="20" title="translate" />
+ </label>
+ </div>
+ </fieldset>
+
+
+
<div class="styled-checkbox">
<input type="checkbox" id="mirror-skeleton" name="mirror-skeleton" value="mirror" checked>
<label for="mirror-skeleton">Mirror Left/Right Joints</label>
diff --git a/src/radio-button-group.css b/src/radio-button-group.css
new file mode 100644
index 0000000..182738c
--- /dev/null
+++ b/src/radio-button-group.css
@@ -0,0 +1,61 @@
+:root {
+ --primary-color: #4B9DEA;
+}
+
+fieldset {
+ border: none;
+}
+
+.toggle {
+ margin: 0 0 1.5rem;
+ box-sizing: border-box;
+ font-size: 0;
+ display: flex;
+ flex-flow: row nowrap;
+ justify-content: flex-start;
+ align-items: stretch;
+}
+
+/* hide the actual radio button input elements */
+.toggle input {
+ width: 0;
+ height: 0;
+ position: absolute;
+ left: -9999px;
+}
+
+/* main default style for the elements */
+.toggle input + label {
+ padding: .5rem 1rem;
+ padding-top: 1rem;
+ border: solid 2px var(--primary-color);
+ font-size: 1rem;
+ transition: border-color .15s ease-out,
+ color .25s ease-out,
+ background-color .15s ease-out,
+ box-shadow .15s ease-out;
+}
+
+/* border radius for first and last elements */
+.toggle input + label:first-of-type {
+ border-radius: 6px 0 0 6px;
+ border-right: none;
+}
+.toggle input + label:last-of-type {
+ border-radius: 0 6px 6px 0;
+ border-left: none;
+}
+
+/* border color when hovering over the element */
+.toggle input:hover + label {
+ border-color: var(--primary-color);
+ background: #5482ad70;
+}
+
+/* active state */
+.toggle input:checked + label {
+ background-color: var(--primary-color);
+ color: #FFF;
+ border-color: var(--primary-color);
+ z-index: 1;
+}