<main>
<div class="triangle"></div>
<div class="triangle"></div>
</main>
main {
perspective: 1000px;
perspective-origin: 50% 50%;
}
@keyframes rot {
from {
transform: rotateX(0deg) rotateY(0deg);
}
to {
transform: rotateX(360deg) rotateY(360deg);
}
}
.triangle {
background-color: #FF00FF;
position: relative;
clip-path: polygon(50% 0, 0 100%, 100% 100%);
transition: transform 4s linear;
transform-style: preserve-3d;
animation: rot 8s infinite linear;
overflow: hidden;
position: absolute;
}
.triangle:nth-child(1) {
top: 0;
left: 50px;
width: 100px;
height: 100px;
}
.triangle:nth-child(2) {
width: 150px;
height: 150px;
left: 300px;
background-color: brown;
background-image: repeating-linear-gradient(-45deg,
transparent,
transparent 20px,
black 20px,
black 40px);
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.