-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
119 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<script lang="ts"> | ||
export let x_angle = 0 | ||
export let y_angle = 0 | ||
export let auto_rotate: 'x' | 'y' | 'both' | 'none' = `none` | ||
let show_easter_egg = false | ||
</script> | ||
|
||
<div class:visible={show_easter_egg}> | ||
<p>You found the easter egg!</p> | ||
<label> | ||
Rotate X = <span>{parseFloat(x_angle.toFixed(0))}</span> | ||
<input type="range" bind:value={x_angle} max={360} /> | ||
</label> | ||
<label> | ||
Rotate Y = <span>{parseFloat(y_angle.toFixed(0))}</span> | ||
<input type="range" bind:value={y_angle} max={360} /> | ||
</label> | ||
<section> | ||
Auto rotate | ||
{#each [`x`, `y`, `both`, `none`] as value} | ||
{@const checked = value === `none`} | ||
<label> | ||
<input type="radio" bind:group={auto_rotate} {value} {checked} />{value} | ||
</label> | ||
{/each} | ||
</section> | ||
<button on:click|stopPropagation={() => (show_easter_egg = !show_easter_egg)}> | ||
close | ||
</button> | ||
</div> | ||
|
||
<style> | ||
div { | ||
position: fixed; | ||
bottom: 1em; | ||
right: 1em; | ||
opacity: 0; | ||
background-color: rgba(255, 255, 255, 0.1); | ||
padding: 3pt 8pt; | ||
border-radius: 3pt; | ||
transition: opacity 0.3s; | ||
overflow: hidden; | ||
} | ||
div:not(.visible) > :is(label, input) { | ||
/* don't react to mouse input if easter egg is hidden */ | ||
pointer-events: none; | ||
} | ||
div.visible { | ||
opacity: 1; | ||
pointer-events: auto; | ||
} | ||
div > p { | ||
margin: 0; | ||
} | ||
div > label { | ||
display: flex; | ||
align-items: center; | ||
} | ||
div > label > span { | ||
min-width: 3.5ex; | ||
padding-left: 3pt; | ||
} | ||
div > label > input { | ||
margin-left: 1em; | ||
} | ||
div > label > input[type='range'] { | ||
flex: 1; | ||
padding: 1ex; | ||
min-width: 13em; | ||
} | ||
div > button { | ||
position: absolute; | ||
bottom: 0; | ||
right: 0; | ||
background-color: rgba(255, 255, 255, 0.2); | ||
border: none; | ||
color: white; | ||
padding: 4pt 6pt; | ||
border-radius: 1ex 0 0 0; | ||
cursor: pointer; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters