-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
show basic counts / poses on a dance
- Loading branch information
Showing
3 changed files
with
63 additions
and
0 deletions.
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,57 @@ | ||
<script> | ||
import { LEFT_RIGHT_COLORING_LIGHT } from '$lib/constants'; | ||
import { DanceWrapper } from '$lib/instructor/bouncy_instructor'; | ||
import Svg from './avatar/Svg.svelte'; | ||
import SvgAvatar from './avatar/SvgAvatar.svelte'; | ||
/** @type {DanceWrapper} */ | ||
export let dance; | ||
let innerWidth = 300; | ||
$: beats = dance.beats; | ||
$: poseWidth = innerWidth / 8; | ||
function count(beat) { | ||
if (beat % 2 === 1) { | ||
return '+'; | ||
} else { | ||
return (beat % 8) / 2 + 1; | ||
} | ||
} | ||
</script> | ||
|
||
<div class="poses" bind:clientWidth={innerWidth}> | ||
{#each { length: beats } as _, beat} | ||
<!-- <Pose /> --> | ||
<div class="avatar" style="width: {poseWidth}px"> | ||
<div class="count"> | ||
{count(beat)} | ||
</div> | ||
<Svg width={200} height={200} orderByZ> | ||
<SvgAvatar | ||
skeleton={dance.skeleton(beat)} | ||
width={200} | ||
height={200} | ||
style={LEFT_RIGHT_COLORING_LIGHT} | ||
></SvgAvatar> | ||
</Svg> | ||
</div> | ||
{/each} | ||
</div> | ||
|
||
<style> | ||
.poses { | ||
display: grid; | ||
grid-template-columns: repeat(8, 1fr); | ||
} | ||
.avatar { | ||
position: relative; | ||
width: 100px; | ||
margin-bottom: 30px; | ||
} | ||
.count { | ||
text-align: center; | ||
margin: 0 0 -10px; | ||
} | ||
</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
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