mirror of
https://github.com/GuerillaStudio/souvenir.git
synced 2025-01-20 22:30:20 +00:00
feat: Setup countdown overlay
This commit is contained in:
parent
7e23ee4591
commit
d9a0d40f91
4 changed files with 62 additions and 5 deletions
|
@ -56,6 +56,19 @@
|
||||||
background: var(--btn-primary);
|
background: var(--btn-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn--danger,
|
||||||
|
.btn--danger:link,
|
||||||
|
.btn--danger:visited {
|
||||||
|
background: linear-gradient(116.15deg, #dd2828 0%, #a72020 100%);
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn--danger:hover,
|
||||||
|
.btn--danger:active,
|
||||||
|
.btn--danger:focus {
|
||||||
|
background: linear-gradient(116.15deg, #dd2828 0%, #a72020 100%);
|
||||||
|
}
|
||||||
|
|
||||||
/* Loading state
|
/* Loading state
|
||||||
-------------------------------------------------------------- */
|
-------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
|
@ -121,3 +121,21 @@
|
||||||
width: 3rem;
|
width: 3rem;
|
||||||
height: 3rem;
|
height: 3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Timer overlay
|
||||||
|
-------------------------------------------------------------- */
|
||||||
|
|
||||||
|
.capture-timer {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
color: #fff;
|
||||||
|
text-shadow: 0 0 1rem var(--color-tertiary);
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 10rem;
|
||||||
|
}
|
||||||
|
|
16
src/views/components/capture-timer.vue
Normal file
16
src/views/components/capture-timer.vue
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<template>
|
||||||
|
<div class="capture-timer">{{ time }}</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'captureTimer',
|
||||||
|
props: {
|
||||||
|
time: {
|
||||||
|
type: Number,
|
||||||
|
required: true,
|
||||||
|
default: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -7,18 +7,26 @@
|
||||||
|
|
||||||
<div class="preview">
|
<div class="preview">
|
||||||
<video ref="preview" class="preview-visual" :class="{ 'preview--flip': shouldFlip }" preload="yes" autoplay muted playsinline webkit-playsinline></video>
|
<video ref="preview" class="preview-visual" :class="{ 'preview--flip': shouldFlip }" preload="yes" autoplay muted playsinline webkit-playsinline></video>
|
||||||
|
<capture-timer v-if="timerActive" :time="timerProgress"></capture-timer>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="capture-actions">
|
<div class="capture-actions">
|
||||||
<button class="capture-btn" :class="{ 'capture-btn--capturing': capturing }" :disabled="!camera" @click.prevent="startCapturing">Capture</button>
|
<template v-if="!timerActive">
|
||||||
<button class="capture-switch" title="Switch camera" @click="switchCamera"><icon-switch></icon-switch></button>
|
<button class="capture-btn" :class="{ 'capture-btn--capturing': capturing }" :disabled="!camera" @click.prevent="startCapturing">Capture</button>
|
||||||
|
<button class="capture-switch" title="Switch camera" @click="switchCamera"><icon-switch></icon-switch></button>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<button class="btn btn--danger w100">Cancel countdown</button>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import captureOptions from '/views/components/capture-options'
|
import captureOptions from '/views/components/capture-options'
|
||||||
import captureProgress from '/views/components/capture-progress'
|
import captureProgress from '/views/components/capture-progress'
|
||||||
|
import captureTimer from '/views/components/capture-timer'
|
||||||
import { capture } from '/services/capture.js'
|
import { capture } from '/services/capture.js'
|
||||||
|
|
||||||
import 'objectFitPolyfill'
|
import 'objectFitPolyfill'
|
||||||
|
@ -32,19 +40,21 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
captureOptions,
|
captureOptions,
|
||||||
captureProgress,
|
captureProgress,
|
||||||
|
captureTimer,
|
||||||
iconSwitch
|
iconSwitch
|
||||||
},
|
},
|
||||||
data: () => ({
|
data: () => ({
|
||||||
capturing: false,
|
capturing: false,
|
||||||
capturingProgress: 0,
|
capturingProgress: 0,
|
||||||
countdown: false,
|
timerActive: false,
|
||||||
countdownProgress: 0
|
timerProgress: 5
|
||||||
}),
|
}),
|
||||||
computed: {
|
computed: {
|
||||||
...mapState([
|
...mapState([
|
||||||
'camera',
|
'camera',
|
||||||
'duration',
|
'duration',
|
||||||
'capture'
|
'capture',
|
||||||
|
'timer'
|
||||||
]),
|
]),
|
||||||
shouldFlip () {
|
shouldFlip () {
|
||||||
if (this.camera) {
|
if (this.camera) {
|
||||||
|
|
Loading…
Reference in a new issue