Feat : improve shadow effect

This commit is contained in:
2024-05-24 12:28:36 +02:00
parent 66b6cc61e9
commit a6fcc28ced
2 changed files with 16 additions and 15 deletions
+14 -13
View File
@@ -11,7 +11,8 @@ export interface Props {
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
wrapped: () => false, wrapped: () => false,
tilted: () => true tilted: () => true,
locked: () => true
}) })
@@ -44,9 +45,9 @@ watch(
</script> </script>
<template> <template>
<div :class="`card ${childCount > 0 ? 'active' : ''} ${wrapped ? 'wrapped' : ''} ${props.locked ? 'locked' : ''}`" <div class="card" :class="{ active: childCount > 0, wrapped, unlocked: !props.locked }" @contextmenu.prevent="false"
@contextmenu.prevent="false" @click.left="cardClick" :style="tilted ? `rotate:${rotation}deg;` : ''" @click.left="cardClick" :style="tilted ? `rotate:${rotation}deg;` : ''" @mouseenter="mouseenter"
@mouseenter="mouseenter" @mouseleave="mouseleave"> @mouseleave="mouseleave">
<div id="contextMenuButtons" :ref="(el) => { childCount = ((el as Element)?.childElementCount ?? 0) }"> <div id="contextMenuButtons" :ref="(el) => { childCount = ((el as Element)?.childElementCount ?? 0) }">
<slot></slot> <slot></slot>
</div> </div>
@@ -66,15 +67,18 @@ watch(
<style scoped> <style scoped>
.card { .card {
--max-height: 250px;
--margin-bottom: calc(var(--max-height) * 0.05);
transition: 0.025s rotate linear; transition: 0.025s rotate linear;
max-width: 256px; max-width: 256px;
position: relative; position: relative;
display: flex; display: flex;
margin-bottom: 0px; margin-bottom: 0px;
margin-top: 15px; margin-top: var(--margin-bottom);
transition: all .125s cubic-bezier(0.075, 0.82, 0.165, 1); transition: all .125s cubic-bezier(0.075, 0.82, 0.165, 1);
isolation: isolate; isolation: isolate;
pointer-events: all; pointer-events: all;
max-height: var(--max-height);
} }
.card.active { .card.active {
@@ -82,7 +86,7 @@ watch(
} }
.card_image { .card_image {
max-height: 250px; max-height: var(--max-height);
transition: all .125s cubic-bezier(0.075, 0.82, 0.165, 1); transition: all .125s cubic-bezier(0.075, 0.82, 0.165, 1);
z-index: 1; z-index: 1;
} }
@@ -92,20 +96,17 @@ watch(
outline-offset: -2px; outline-offset: -2px;
} }
.card.locked { .card.unlocked {
margin-top: 0px; margin-top: 0px;
margin-bottom: 15px;
filter: drop-shadow(5px 15px 2px rgba(0, 0, 0, .60)); margin-bottom: var(--margin-bottom);
filter: drop-shadow(calc(var(--margin-bottom)*.3) var(--margin-bottom) 1px rgba(0, 0, 0, .60));
} }
.card.wrapped { .card.wrapped {
max-width: 10px; max-width: 10px;
} }
.card_image {
max-height: 250px;
}
#contextMenuButtons { #contextMenuButtons {
position: absolute; position: absolute;
display: flex; display: flex;
+2 -2
View File
@@ -136,7 +136,7 @@ function showWinnerScreen() {
</style> </style>
<style> <style>
#player_list .card_image { #player_list .card {
max-width: 64px; --max-height: 90px;
} }
</style> </style>