mirror of https://github.com/bra1n/townsquare.git
added some fancy animations
This commit is contained in:
parent
7939849989
commit
9b8d86f02c
|
@ -9,6 +9,7 @@
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div class="shroud" @click="toggleStatus()"></div>
|
<div class="shroud" @click="toggleStatus()"></div>
|
||||||
|
<div class="life" @click="toggleStatus()"></div>
|
||||||
<div class="token" @click="changeRole()" :class="[player.role.id]">
|
<div class="token" @click="changeRole()" :class="[player.role.id]">
|
||||||
<span class="leaf-left" v-if="player.role.firstNight"></span>
|
<span class="leaf-left" v-if="player.role.firstNight"></span>
|
||||||
<span class="leaf-right" v-if="player.role.otherNight"></span>
|
<span class="leaf-right" v-if="player.role.otherNight"></span>
|
||||||
|
@ -65,21 +66,21 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
toggleStatus() {
|
toggleStatus() {
|
||||||
if (!this.isPublic || !this.player.hasDied) {
|
if (this.isPublic) {
|
||||||
this.$set(this.player, "hasDied", !this.player.hasDied);
|
|
||||||
if (!this.player.hasDied) {
|
if (!this.player.hasDied) {
|
||||||
|
this.$set(this.player, "hasDied", true);
|
||||||
|
} else if (this.player.hasVoted) {
|
||||||
this.$set(this.player, "hasVoted", false);
|
this.$set(this.player, "hasVoted", false);
|
||||||
|
this.$set(this.player, "hasDied", false);
|
||||||
|
} else {
|
||||||
|
this.$set(this.player, "hasVoted", true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.$set(this.player, "hasVoted", !this.player.hasVoted);
|
this.$set(this.player, "hasDied", !this.player.hasDied);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeRole() {
|
changeRole() {
|
||||||
if (!this.isPublic) {
|
|
||||||
this.$emit("set-role", this.player);
|
this.$emit("set-role", this.player);
|
||||||
} else {
|
|
||||||
this.toggleStatus();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
changeName() {
|
changeName() {
|
||||||
const name = prompt("Player name", this.player.name);
|
const name = prompt("Player name", this.player.name);
|
||||||
|
@ -98,6 +99,7 @@ export default {
|
||||||
/***** Player token *****/
|
/***** Player token *****/
|
||||||
.circle .player {
|
.circle .player {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
padding-top: $token + 6px;
|
||||||
|
|
||||||
.shroud {
|
.shroud {
|
||||||
content: " ";
|
content: " ";
|
||||||
|
@ -111,7 +113,8 @@ export default {
|
||||||
top: -30px;
|
top: -30px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transform: scale(1.5);
|
transform: perspective(400px) scale(1.5);
|
||||||
|
transform-origin: top center;
|
||||||
transition: all 200ms;
|
transition: all 200ms;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
&:hover {
|
&:hover {
|
||||||
|
@ -124,14 +127,55 @@ export default {
|
||||||
&.dead .shroud {
|
&.dead .shroud {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
top: 0;
|
top: 0;
|
||||||
transform: scale(1);
|
transform: perspective(400px) scale(1);
|
||||||
}
|
}
|
||||||
&.dead .name {
|
&.dead .name {
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#townsquare.public .player.dead {
|
/****** Life token *******/
|
||||||
|
.player .life {
|
||||||
|
border-radius: 50%;
|
||||||
|
height: $token + 6px;
|
||||||
|
width: $token + 6px;
|
||||||
|
background: url("../assets/life.png") center center;
|
||||||
|
background-size: 100%;
|
||||||
|
margin: auto;
|
||||||
|
border: 3px solid black;
|
||||||
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: transform 200ms ease-in-out;
|
||||||
|
transform: perspective(400px) rotateY(180deg);
|
||||||
|
backface-visibility: hidden;
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
top: 0;
|
||||||
|
margin-left: ($token + 6) / -2;
|
||||||
|
}
|
||||||
|
|
||||||
|
#townsquare.public .player {
|
||||||
|
.shroud {
|
||||||
|
transform: perspective(400px) rotateX(90deg);
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.life {
|
||||||
|
transform: perspective(400px) rotateY(0deg)
|
||||||
|
}
|
||||||
|
|
||||||
|
&.dead {
|
||||||
|
&.traveller {
|
||||||
|
filter: grayscale(100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.no-vote .life:after {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.life {
|
||||||
|
background-image: url("../assets/death.png");
|
||||||
|
|
||||||
&:after {
|
&:after {
|
||||||
content: " ";
|
content: " ";
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -139,32 +183,23 @@ export default {
|
||||||
top: 0;
|
top: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: url("../assets/vote.png") center center no-repeat;
|
background: url("../assets/vote.png") center center no-repeat;
|
||||||
background-size: 40%;
|
background-size: 50%;
|
||||||
height: $token + 3px;
|
height: $token + 3px;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
&.traveller:after {
|
|
||||||
filter: grayscale(100%);
|
|
||||||
}
|
|
||||||
&.no-vote:after {
|
|
||||||
display: none;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#townsquare.public .player .shroud {
|
|
||||||
display: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Role token ******/
|
/***** Role token ******/
|
||||||
.circle .token {
|
.circle .token {
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
height: $token + 3px;
|
height: $token + 6px;
|
||||||
width: $token + 3px;
|
width: $token + 6px;
|
||||||
background: url("../assets/token.png") center center;
|
background: url("../assets/token.png") center center;
|
||||||
background-size: 100%;
|
background-size: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: black;
|
color: black;
|
||||||
margin: auto;
|
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff,
|
text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff,
|
||||||
1px 1px 0 #fff, 0 0 5px rgba(0, 0, 0, 0.75);
|
1px 1px 0 #fff, 0 0 5px rgba(0, 0, 0, 0.75);
|
||||||
|
@ -173,6 +208,13 @@ export default {
|
||||||
border: 3px solid black;
|
border: 3px solid black;
|
||||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
transition: transform 200ms ease-in-out;
|
||||||
|
transform: perspective(400px) rotateY(0deg);
|
||||||
|
backface-visibility: hidden;
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
top: 0;
|
||||||
|
margin-left: ($token + 6) / -2;
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
content: " ";
|
content: " ";
|
||||||
|
@ -220,23 +262,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
#townsquare.public .token {
|
#townsquare.public .token {
|
||||||
background-image: url("../assets/life.png");
|
transform: perspective(400px) rotateY(-180deg);
|
||||||
div {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
&:before,
|
|
||||||
&:after,
|
|
||||||
span {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#townsquare.public .player.dead .token {
|
|
||||||
background-image: url("../assets/death.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
#townsquare.public .player.traveller .token {
|
|
||||||
filter: grayscale(100%);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Player name *****/
|
/***** Player name *****/
|
||||||
|
|
|
@ -188,6 +188,9 @@ export default {
|
||||||
> * {
|
> * {
|
||||||
transform: rotate($rot * -1deg);
|
transform: rotate($rot * -1deg);
|
||||||
}
|
}
|
||||||
|
.life, .token {
|
||||||
|
transition-delay: $i * 50ms;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$rot: $rot + $angle;
|
$rot: $rot + $angle;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue