feat: video player animations
This commit is contained in:
parent
8b97f20167
commit
8774fbc306
1 changed files with 24 additions and 2 deletions
|
@ -1,11 +1,27 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { createEventDispatcher } from "svelte";
|
import { createEventDispatcher, onMount } from "svelte";
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
export let url: string;
|
export let url: string;
|
||||||
|
|
||||||
|
let visible = false;
|
||||||
|
onMount(() => {
|
||||||
|
visible = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
function exit() {
|
||||||
|
if (visible == false) {
|
||||||
|
dispatch("exit");
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="videoPlayer" on:click={() => dispatch("exit")}>
|
<div
|
||||||
|
class="videoPlayer"
|
||||||
|
on:click={() => (visible = false)}
|
||||||
|
class:visible
|
||||||
|
on:transitionend={() => exit()}
|
||||||
|
>
|
||||||
<!-- svelte-ignore a11y-media-has-caption -->
|
<!-- svelte-ignore a11y-media-has-caption -->
|
||||||
<video controls autoplay src={url} />
|
<video controls autoplay src={url} />
|
||||||
</div>
|
</div>
|
||||||
|
@ -26,5 +42,11 @@
|
||||||
left: 50%;
|
left: 50%;
|
||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
transition: opacity 0.5s;
|
||||||
|
opacity: 0;
|
||||||
|
&.visible {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in a new issue