<div class="decoration">
<div class="panel">
<img class="cover" src="https://raw.githubusercontent.com/robole/artifice/main/christmas-decoration/img/cover.jpg" alt="christmas tree cover" />
</div>
<div class="panel">
<img class="hat" src="https://raw.githubusercontent.com/robole/artifice/main/christmas-decoration/img/hat-reversed.png" alt="hat" />
</div>
<div class="panel">
<img class="hat" src="https://raw.githubusercontent.com/robole/artifice/main/christmas-decoration/img/hat.png" alt="hat" />
</div>
<div class="panel">
<img class="hat" src="https://raw.githubusercontent.com/robole/artifice/main/christmas-decoration/img/snowy-scene.jpg" alt="christmas tree cover" />
</div>
</div>
/* Source code:
https://github.com/robole/artifice
*/
:root {
--panel-width: 250px;
}
body {
background-color: aquamarine;
}
.decoration {
display: flex;
perspective: 1500px;
width: calc(2 * var(--panel-width));
margin-top:8rem;
}
.cover {
width: inherit;
height: inherit;
object-fit: cover;
mask-image: url(https://raw.githubusercontent.com/robole/artifice/main/christmas-decoration/img/hat-mask.png);
mask-mode: alpha;
mask-size: cover;
mask-repeat: no-repeat;
mask-position: 50% 50%;
-webkit-mask-image: url(https://raw.githubusercontent.com/robole/artifice/main/christmas-decoration/img/hat-mask.png);
-webkit-mask-mode: alpha;
-webkit-mask-size: cover;
-webkit-mask-repeat: no-repeat;
-webkit-mask-position: 50% 50%;
}
.panel {
width: var(--panel-width);
height: calc(var(--panel-width) * 1.25);
transform-style: preserve-3d;
}
.panel:nth-child(1) {
background-color: transparent;
transform-origin: 100% center;
transform: rotateY(40deg);
z-index: 40;
animation: fold 3s alternate infinite;
animation-timing-function: ease-in-out;
}
.panel:nth-child(2) {
background-color: rgb(241, 241, 241);
border-left: 3px solid rgba(0, 0, 0, 0.2);
border-right: 3px solid rgba(0, 0, 0, 0.1);
transform-origin: 0% center;
transform: rotateY(-40deg);
}
.panel:nth-child(3) {
background-color: red;
border-right: 3px solid rgba(0, 0, 0, 0.1);
transform-origin: 100% center;
transform: rotateY(27deg) translate3d(-98px, 0, 0);
}
.panel:nth-child(4) {
background-color: transparent;
border-left: 3px solid rgba(0, 0, 0, 0.2);
transform-origin: 0% center;
transform: rotateY(-23deg) translate3d(-66px, 0, 73px);
}
.hat {
width: inherit;
height: inherit;
object-fit: cover;
filter: drop-shadow(1px 1px rgba(0, 0, 0, 0.5));
}
@keyframes fold {
80%,
100% {
transform: rotateY(140deg);
}
}
// not today
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.