Commit b36225d0 by zhangyongfeng

增加抽奖结束时的结果动画,使中奖动画更自然

parent 9ea65295
...@@ -19,18 +19,20 @@ ...@@ -19,18 +19,20 @@
</li> </li>
</ul> </ul>
</div> </div>
<div id="resbox" v-show="showRes"> <transition name="bounce">
<p @click="showRes = false">{{ categoryName }}抽奖结果:</p> <div id="resbox" v-show="showRes">
<span <p @click="showRes = false">{{ categoryName }}抽奖结果:</p>
v-for="item in resArr" <span
:key="item" v-for="item in resArr"
class="itemres" :key="item"
:style="resCardStyle" class="itemres"
@click="showRes = false" :style="resCardStyle"
> @click="showRes = false"
{{ item }} >
</span> {{ item }}
</div> </span>
</div>
</transition>
<LotteryConfig :visible.sync="showConfig" @resetconfig="reloadTagCanvas" /> <LotteryConfig :visible.sync="showConfig" @resetconfig="reloadTagCanvas" />
<Tool @toggle="toggle" @resetConfig="reloadTagCanvas" :running="running" /> <Tool @toggle="toggle" @resetConfig="reloadTagCanvas" :running="running" />
...@@ -61,7 +63,7 @@ export default { ...@@ -61,7 +63,7 @@ export default {
computed: { computed: {
resCardStyle() { resCardStyle() {
const style = {}; const style = { fontSize: '30px' };
const { number } = this.config; const { number } = this.config;
if (number < 100) { if (number < 100) {
style.fontSize = '100px'; style.fontSize = '100px';
...@@ -182,9 +184,7 @@ export default { ...@@ -182,9 +184,7 @@ export default {
if (this.running) { if (this.running) {
window.TagCanvas.SetSpeed('rootcanvas', speed()); window.TagCanvas.SetSpeed('rootcanvas', speed());
this.reloadTagCanvas(); this.reloadTagCanvas();
setTimeout(() => { this.showRes = true;
this.showRes = true;
}, 300);
} else { } else {
this.showRes = false; this.showRes = false;
const { number } = config; const { number } = config;
...@@ -257,6 +257,12 @@ export default { ...@@ -257,6 +257,12 @@ export default {
color: #ccc; color: #ccc;
font-size: 12px; font-size: 12px;
} }
.bounce-enter-active {
animation: bounce-in 1.5s;
}
.bounce-leave-active {
animation: bounce-in 0.2s reverse;
}
} }
#main { #main {
height: 100%; height: 100%;
...@@ -282,7 +288,6 @@ export default { ...@@ -282,7 +288,6 @@ export default {
border-radius: 4px; border-radius: 4px;
border: 1px solid #ccc; border: 1px solid #ccc;
line-height: 160px; line-height: 160px;
font-size: 80px;
font-weight: bold; font-weight: bold;
margin-right: 20px; margin-right: 20px;
margin-top: 20px; margin-top: 20px;
......
...@@ -16,3 +16,33 @@ ...@@ -16,3 +16,33 @@
left: -400%; left: -400%;
} }
} }
@-webkit-keyframes bounce-in {
0% {
-webkit-transform: translateX(-50%) translateY(-50%) scale(0);
transform: translateX(-50%) translateY(-50%) scale(0);
}
50% {
-webkit-transform: translateX(-50%) translateY(-50%) scale(1.5);
transform: translateX(-50%) translateY(-50%) scale(1.5);
}
100% {
-webkit-transform: translateX(-50%) translateY(-50%) scale(1);
transform: translateX(-50%) translateY(-50%) scale(1);
}
}
@keyframes bounce-in {
0% {
-webkit-transform: translateX(-50%) translateY(-50%) scale(0);
transform: translateX(-50%) translateY(-50%) scale(0);
}
50% {
-webkit-transform: translateX(-50%) translateY(-50%) scale(1.5);
transform: translateX(-50%) translateY(-50%) scale(1.5);
}
100% {
-webkit-transform: translateX(-50%) translateY(-50%) scale(1);
transform: translateX(-50%) translateY(-50%) scale(1);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment