added vote arrow styling

This commit is contained in:
Steffen 2020-06-01 12:59:39 +02:00
parent d689ded8bc
commit 7b5e228318
No known key found for this signature in database
GPG Key ID: 764D74E98267DFC6
1 changed files with 84 additions and 8 deletions

View File

@ -1,15 +1,16 @@
<template> <template>
<div class="vote"> <div class="vote">
<div class="arrows"> <div class="arrows">
<span class="nominator"></span> <span class="nominee" :style="nomineeStyle"></span>
<span class="nominee"></span> <span class="nominator" :style="nominatorStyle"></span>
</div> </div>
<div class="overlay"> <div class="overlay">
<em>{{ nominator.name }}</em> nominated <em>{{ nominee.name }}</em <em class="blue">{{ nominator.name }}</em> nominated
<em>{{ nominee.name }}</em
>! >!
<br /> <br />
<template v-if="nominee.role.team !== 'traveler'"> <template v-if="nominee.role.team !== 'traveler'">
<em>{{ Math.ceil(alive / 2) }} votes</em> required for an <em class="blue">{{ Math.ceil(alive / 2) }} votes</em> required for an
<em>execution</em> <em>execution</em>
</template> </template>
<template v-else> <template v-else>
@ -34,11 +35,25 @@ export default {
this.$store.state.session.nomination[0] this.$store.state.session.nomination[0]
]; ];
}, },
nominatorStyle: function() {
const players = this.$store.state.players.players.length;
const nomination = this.$store.state.session.nomination[0];
return {
transform: `rotate(${Math.round((nomination / players) * 360)}deg)`
};
},
nominee: function() { nominee: function() {
return this.$store.state.players.players[ return this.$store.state.players.players[
this.$store.state.session.nomination[1] this.$store.state.session.nomination[1]
]; ];
}, },
nomineeStyle: function() {
const players = this.$store.state.players.players.length;
const nomination = this.$store.state.session.nomination[1];
return {
transform: `rotate(${Math.round((nomination / players) * 360)}deg)`
};
},
...mapState("players", ["players"]), ...mapState("players", ["players"]),
...mapState(["session"]), ...mapState(["session"]),
...mapGetters({ alive: "players/alive" }) ...mapGetters({ alive: "players/alive" })
@ -56,23 +71,84 @@ export default {
.vote { .vote {
position: absolute; position: absolute;
height: 300px; width: 20%;
width: 300px;
z-index: 20; z-index: 20;
display: flex; display: flex;
align-items: center; align-items: center;
align-content: center; align-content: center;
justify-content: center; justify-content: center;
background: url("../assets/demon-head.png") center center no-repeat; background: url("../assets/demon-head.png") center center no-repeat;
background-size: auto 100%; background-size: auto 75%;
text-align: center; text-align: center;
text-shadow: 0 1px 2px #000000, 0 -1px 2px #000000, 1px 0 2px #000000, text-shadow: 0 1px 2px #000000, 0 -1px 2px #000000, 1px 0 2px #000000,
-1px 0 2px #000000; -1px 0 2px #000000;
&:after {
content: " ";
padding-bottom: 100%;
display: block;
}
em { em {
color: red; color: $demon;
font-style: normal; font-style: normal;
font-weight: bold; font-weight: bold;
&.blue {
color: $townsfolk;
}
}
}
@keyframes arrow-cw {
0% {
opacity: 0;
transform: rotate(-180deg);
}
100% {
opacity: 1;
transform: rotate(0deg);
}
}
@keyframes arrow-ccw {
0% {
opacity: 0;
transform: rotate(180deg);
}
100% {
opacity: 1;
transform: rotate(0deg);
}
}
.arrows {
position: absolute;
display: flex;
height: 150%;
width: 20%;
span {
position: absolute;
width: 100%;
height: 100%;
}
span:before {
content: " ";
width: 100%;
height: 100%;
display: block;
background-size: auto 100%;
background-repeat: no-repeat;
background-position: center center;
position: absolute;
filter: drop-shadow(0px 0px 3px #000);
}
.nominator:before {
background-image: url("../assets/clock-small.png");
animation: arrow-ccw 1s ease-out;
}
.nominee:before {
background-image: url("../assets/clock-big.png");
animation: arrow-cw 1s ease-out;
} }
} }
</style> </style>