JSFiddle - React, Tailwind, and code Playground
by Dexmaster
HTML
<div class="icons">
<div class="icon-1">
<svg viewBox="0 0 70 76">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#red_box_on_v"></use>
</svg>
</div>
</div>
<svg width="0" height="0" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<g id="red_box_on_v">
<g>
<polygon fill="#ED1C24" points="70,18 70,62 30.8,76 0.1,14 "></polygon>
</g>
<g>
<polygon fill="#C91D23" points="30.8,76 0,58.8 0.1,14 31,31.4 "></polygon>
</g>
<g>
<polygon fill="#A01D22" points="31,31.4 0.1,14 39.2,0.7 70,18 "></polygon>
</g>
</g>
</defs>
</svg>
CSS
.icon-1 {
width: 3em;
height: 3em;
margin: 85px auto;
transition: all ease 1s;
}
.icons {
width:80%;
margin: 0 auto;
height:90px;
transition: all ease 1s;
animation: pull 3s infinite reverse ease-in-out;
}
.icon-1:active {
animation: rotate360 4s infinite reverse cubic-bezier(0, 0, 1, 1);
animation-delay: 2s;
}
.icons:active {
animation: changePosition 1s ease-in-out;
animation-delay: 1s;
}
@keyframes changePosition{
0% {
transform: rotate(0deg) translateY(0) translateX(0);
}
100% {
transform: rotate(0deg) translateY(100px) translateX(0);
}
}
@keyframes pull {
0% {
transform: translateY(0px);
}
50% {
transform: translateY(-55px);
}
100%{
transform: translateY(0px);
}
}
@keyframes rotate360 {
0% {
transform: rotate(0deg) translateY(100px) translateX(0);
}
25% {
transform: rotate(90deg) translateY(100px) translateX(100px);
}
50% {
transform: rotate(180deg) translateY(200px) translateX(0);
}
75% {
transform: rotate(270deg) translateY(100px) translateX(100px);
}
100% {
transform: rotate(360deg) translateY(100px) translateX(0);
}
}