Dancing Cactus by
Victoria Retallick
On: 1 Aug 2016
Personal site: http://www.twitter.com/retallicka
<!-- <div class="drawing">
<img src="http://i.imgur.com/PssBvu4.jpg">
</div> -->
<div class="scene">
<div class="cactus-container">
<div class="cactus-body">
<div class="flowers">
<div class="flower"></div>
<div class="flower"></div>
<div class="flower"></div>
<div class="flower"></div>
</div>
<div class="face">
<div class="left-eye eye"></div>
<div class="right-eye eye"></div>
<div class="mouth">
<div class="inner-mouth"></div>
</div>
</div>
<div class="left-arm arm"></div>
<div class="right-arm arm"></div>
<div class="spines">
<div class="spine"></div>
<div class="spine"></div>
<div class="spine"></div>
<div class="spine"></div>
<div class="spine"></div>
<div class="spine"></div>
<div class="spine"></div>
<div class="spine"></div>
</div>
</div>
<div class="pot">
<div class="top-pot"></div>
<div class="bottom-pot"></div>
</div>
</div>
</div>
.center, .drawing, .cactus-container, .flowers, .cactus-body, .face, .mouth, .inner-mouth, .pot {
margin: auto;
left: 0;
right: 0;
}
.scene {
width: 100%;
height: 100%;
opacity: 1;
background-color: #ffffcc;
}
.drawing {
position: absolute;
width: 400px;
height: 400px;
}
.cactus-container {
width: 200px;
height: 300px;
padding: 40px;
animation: body 0.5s infinite alternate ease-in-out;
}
.flowers {
position: absolute;
top: 0;
width: 50px;
height: 50px;
}
.flower {
position: absolute;
background-color: #ff0055;
height: 100%;
top: -90%;
width: 40%;
border-radius: 20% 50%;
}
.flower::after {
position: absolute;
content: '';
height: 90%;
width: 90%;
top: 5%;
left: 5%;
background-color: #ff6699;
border-radius: 20% 50%;
}
.flower:nth-child(2) {
left: -20px;
width: 44%;
top: -94%;
transform: rotate(-20deg);
z-index: -10;
}
.flower:nth-child(3) {
left: 20px;
width: 38%;
top: -94%;
transform: rotate(20deg);
}
.flower:nth-child(4) {
left: 36px;
width: 44%;
top: -94%;
transform: rotate(39deg);
z-index: -10;
}
.cactus-body {
position: relative;
width: 150px;
height: 170px;
background: #1f7a1f;
background: -webkit-linear-gradient(legacy-direction(to right), #1f7a1f 0%, #33cc33 40%, #1f7a1f 100%);
background: linear-gradient(to right, #1f7a1f 0%, #33cc33 40%, #1f7a1f 100%);
background-color: #33cc33;
border-radius: 20px;
z-index: 100;
animation: cactus-body 0.5s infinite alternate linear;
}
.face {
position: relative;
width: 50%;
height: 50px;
}
.eye {
position: absolute;
top: 40px;
height: 20px;
width: 6px;
margin: 20px;
background-color: #000;
border-radius: 8px;
animation: eyes 4s infinite alternate ease-out;
}
.left-eye {
left: 40px;
}
.right-eye {
right: 40px;
}
.mouth {
position: relative;
top: 90px;
width: 10px;
height: 10px;
background-color: #000;
border-radius: 0 0 10px 10px;
}
.inner-mouth {
width: 6px;
height: 6px;
background-color: #33cc33;
border-radius: 0 0 10px 10px;
}
.arm {
position: absolute;
height: 30px;
width: 30px;
top: 100px;
background-color: #33cc33;
background: #1f7a1f;
background: -webkit-linear-gradient(legacy-direction(to right), #1f7a1f 0%, #33cc33 40%, #1f7a1f 100%);
background: linear-gradient(to right, #1f7a1f 0%, #33cc33 40%, #1f7a1f 100%);
}
.left-arm {
left: -30px;
animation: left-arm 0.5s infinite alternate ease-out;
}
.right-arm {
right: -30px;
animation: right-arm 0.5s infinite alternate ease-in;
}
.spines .spine {
position: absolute;
height: 0;
width: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 20px solid #1a661a;
}
.spines .spine:nth-child(1) {
transform: rotate(-20deg);
top: 0;
}
.spines .spine:nth-child(2) {
top: 49px;
left: -3px;
transform: rotate(-47deg);
}
.spines .spine:nth-child(3) {
top: 110px;
left: 23px;
transform: rotate(-29deg);
}
.spines .spine:nth-child(4) {
top: 10px;
right: 23px;
transform: rotate(29deg);
}
.spines .spine:nth-child(5) {
top: 30px;
right: -8px;
transform: rotate(45deg);
}
.spines .spine:nth-child(6) {
top: 70px;
right: 20px;
transform: rotate(19deg);
}
.spines .spine:nth-child(7) {
top: 140px;
right: 40px;
transform: rotate(32deg);
}
.spines .spine:nth-child(8) {
top: 10px;
left: 50px;
transform: rotate(-20deg);
}
.pot {
width: 160px;
height: 120px;
}
.top-pot {
position: relative;
top: -10%;
left: -5%;
width: 110%;
height: 60%;
background-color: #0052cc;
border-radius: 80px;
}
.top-pot::after {
position: absolute;
content: '';
z-index: 200;
bottom: 10px;
left: 5%;
width: 90%;
height: 10px;
background-color: #0052cc;
border-radius: 0 0 50px 50px;
}
.bottom-pot {
position: relative;
top: -30px;
width: 80px;
height: 10px;
border-left: 40px solid transparent;
border-right: 40px solid transparent;
border-top: 80px solid #0066ff;
}
.bottom-pot::after {
content: '';
position: absolute;
bottom: 0;
height: 50px;
width: 105%;
left: -2.5%;
background-color: #0066ff;
border-radius: 0 0 20px 20px;
}
@keyframes body {
0% {
transform: translateX(18px);
}
50% {
height: 210px;
transform: translateX(0) rotate(-2deg);
}
100% {
transform: translateX(-18px) rotate(2deg);
}
}
@keyframes cactus-body {
0% {
transform: rotate(-10deg);
}
100% {
transform: rotate(10deg);
}
}
@keyframes left-arm {
0% {
transform: translateY(0);
}
100% {
transform: translateY(-50px);
}
}
@keyframes right-arm {
0% {
transform: translateY(-50px);
}
100% {
transform: translateY(0);
}
}
@keyframes eyes {
95% {
height: 20px;
}
100% {
height: 0;
}
}
5