mirror of
https://github.com/CharaChorder/DeviceManager.git
synced 2026-01-22 01:42:47 +00:00
radial thing
This commit is contained in:
@@ -8,65 +8,67 @@
|
|||||||
["g", "h", "i"],
|
["g", "h", "i"],
|
||||||
["j", "k", "l"],
|
["j", "k", "l"],
|
||||||
]
|
]
|
||||||
|
|
||||||
/**
|
|
||||||
* @param index {number}
|
|
||||||
* @returns number
|
|
||||||
*/
|
|
||||||
function calcLayerPosition(index) {
|
|
||||||
return index - activeLayer
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="radial">
|
<div class="radial">
|
||||||
{#each Array.from({length: layers}) as _, i}
|
{#each layout as key, j}
|
||||||
<!--suppress Stylelint -->
|
<!--suppress Stylelint -->
|
||||||
<div
|
<button on:click={() => (activeLayer = (activeLayer + 1) % layers)}>
|
||||||
class="layer"
|
{#each key as value, i}
|
||||||
style="translate: -50% -50% {((i - activeLayer + 1) % 2) - 1}px; filter: brightness({1 -
|
<span class:active={activeLayer === i} style="offset-distance: {j * 25 + (i - activeLayer) * 8}%"
|
||||||
Math.log(1 + Math.abs(i - activeLayer))})"
|
>{value}</span
|
||||||
class:active={activeLayer === i}
|
|
||||||
>
|
>
|
||||||
<button on:click={() => (activeLayer = (activeLayer + 1) % layers)}>{i}</button>
|
{/each}
|
||||||
<button>{i}</button>
|
</button>
|
||||||
<button>{i}</button>
|
|
||||||
<button>{i}</button>
|
|
||||||
</div>
|
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
$border-width: 18px;
|
$border-width: 18px;
|
||||||
$gap: 6px;
|
$gap: 6px;
|
||||||
$size: 96px;
|
$size: 96;
|
||||||
|
$offset: 14;
|
||||||
$scale-difference: 0.2;
|
$scale-difference: 0.2;
|
||||||
|
|
||||||
.radial {
|
.radial {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 0;
|
|
||||||
height: 0;
|
|
||||||
perspective: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layer {
|
|
||||||
pointer-events: none;
|
|
||||||
|
|
||||||
position: absolute;
|
|
||||||
z-index: -1;
|
|
||||||
transform-style: preserve-3d;
|
|
||||||
translate: -50% -50% 0;
|
|
||||||
|
|
||||||
container: radial / size;
|
container: radial / size;
|
||||||
|
|
||||||
width: $size;
|
width: #{$size * 1px};
|
||||||
height: $size;
|
height: #{$size * 1px};
|
||||||
|
|
||||||
transition: all 250ms ease;
|
transition: all 250ms ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.layer.active {
|
span {
|
||||||
pointer-events: all;
|
$cr: $size / 2 - 2 * $offset;
|
||||||
z-index: 1;
|
|
||||||
|
scale: 0.9;
|
||||||
|
offset-path: path(
|
||||||
|
"M#{$size / 2} #{$offset}A#{$cr} #{$cr} 0 1 1 #{$size / 2} #{$size - $offset}A#{$cr} #{$cr} 0 1 1 #{$size / 2} #{$offset}Z"
|
||||||
|
);
|
||||||
|
offset-rotate: 0deg;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
grid-column: 1;
|
||||||
|
grid-row: 1;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
font-size: 16px;
|
||||||
|
|
||||||
|
opacity: 0.3;
|
||||||
|
|
||||||
|
transition: all 250ms ease;
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
scale: 1;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
@@ -74,11 +76,11 @@
|
|||||||
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
||||||
display: flex;
|
display: grid;
|
||||||
|
|
||||||
width: 100cqw;
|
width: 100cqw;
|
||||||
height: 100cqh;
|
height: 100cqh;
|
||||||
padding: 5px;
|
padding: 0;
|
||||||
|
|
||||||
font-family: "Noto Sans Mono", monospace;
|
font-family: "Noto Sans Mono", monospace;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
@@ -99,26 +101,18 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&:nth-child(1) {
|
&:nth-child(1) {
|
||||||
align-items: flex-start;
|
|
||||||
justify-content: center;
|
|
||||||
clip-path: polygon(50% 50%, 0 0, 100% 0);
|
clip-path: polygon(50% 50%, 0 0, 100% 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
&:nth-child(2) {
|
&:nth-child(2) {
|
||||||
align-items: center;
|
|
||||||
justify-content: flex-end;
|
|
||||||
clip-path: polygon(50% 50%, 100% 0, 100% 100%);
|
clip-path: polygon(50% 50%, 100% 0, 100% 100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
&:nth-child(3) {
|
&:nth-child(3) {
|
||||||
align-items: flex-end;
|
|
||||||
justify-content: center;
|
|
||||||
clip-path: polygon(50% 50%, 0 100%, 100% 100%);
|
clip-path: polygon(50% 50%, 0 100%, 100% 100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
&:nth-child(4) {
|
&:nth-child(4) {
|
||||||
align-items: center;
|
|
||||||
justify-content: flex-start;
|
|
||||||
clip-path: polygon(50% 50%, 0 0, 0 100%);
|
clip-path: polygon(50% 50%, 0 0, 0 100%);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user