Skip to content

Commit eae75e1

Browse files
committed
show basic counts / poses on a dance
1 parent d78a9dd commit eae75e1

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<script>
2+
import { LEFT_RIGHT_COLORING_LIGHT } from '$lib/constants';
3+
import { DanceWrapper } from '$lib/instructor/bouncy_instructor';
4+
import Svg from './avatar/Svg.svelte';
5+
import SvgAvatar from './avatar/SvgAvatar.svelte';
6+
7+
/** @type {DanceWrapper} */
8+
export let dance;
9+
10+
let innerWidth = 300;
11+
12+
$: beats = dance.beats;
13+
$: poseWidth = innerWidth / 8;
14+
15+
function count(beat) {
16+
if (beat % 2 === 1) {
17+
return '+';
18+
} else {
19+
return (beat % 8) / 2 + 1;
20+
}
21+
}
22+
</script>
23+
24+
<div class="poses" bind:clientWidth={innerWidth}>
25+
{#each { length: beats } as _, beat}
26+
<!-- <Pose /> -->
27+
<div class="avatar" style="width: {poseWidth}px">
28+
<div class="count">
29+
{count(beat)}
30+
</div>
31+
<Svg width={200} height={200} orderByZ>
32+
<SvgAvatar
33+
skeleton={dance.skeleton(beat)}
34+
width={200}
35+
height={200}
36+
style={LEFT_RIGHT_COLORING_LIGHT}
37+
></SvgAvatar>
38+
</Svg>
39+
</div>
40+
{/each}
41+
</div>
42+
43+
<style>
44+
.poses {
45+
display: grid;
46+
grid-template-columns: repeat(8, 1fr);
47+
}
48+
.avatar {
49+
position: relative;
50+
width: 100px;
51+
margin-bottom: 30px;
52+
}
53+
.count {
54+
text-align: center;
55+
margin: 0 0 -10px;
56+
}
57+
</style>

bouncy_frontend/src/lib/i18n/de-CH.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,9 @@
230230
"left-out": "Links nach aussen"
231231
}
232232
},
233+
"dance": {
234+
"counts": "Zur Musik gezählt"
235+
},
233236
"common": {
234237
"hint-popup-title": "Hinweis"
235238
}

bouncy_frontend/src/lib/i18n/en-GB.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,9 @@
230230
"left-out": "Left leg outwards"
231231
}
232232
},
233+
"dance": {
234+
"counts": "Music counts"
235+
},
233236
"common": {
234237
"hint-popup-title": "Hint"
235238
}

0 commit comments

Comments
 (0)