daily Programming: css flying balloon
Tags: css, daily-programming
HA! HA! HA! 優秀小九九~ 為了讓小柚子 練習眼睛對焦~
買了兩顆 飛高高的氣球~~棒棒的兒~~
- 所以! 今日暖身就來氣球飛高高!!!
參考網站:
code:
<style>
.balloon span {
text-transform: uppercase;
}
.container {
width: 800px;
/* height: 420px; */
padding: 10px;
margin: 0 auto;
position: relative;
}
.balloon {
width: 738px;
margin: 0 auto;
padding-top: 30px;
position: relative;
}
.balloon > div {
width:104px;
height:140px;
background: rgba(182, 15, 97, 0.9);
border-radius:0;
border-radius:80% 80% 80% 80%;
margin: 0 auto;
position: absolute;
padding:10px;
box-shadow:inset 17px 7px 10px rgba(182, 15, 97, 0.9);
-webkit-transform-origin: bottom center;
}
.balloon > div:nth-child(1){
background: rgba(182, 15, 97, 0.9);
left: 0;
box-shadow:inset 10px 10px 10px darken(rgba(182, 15, 97, 0.9), 10%);
-webkit-animation:balloon1 6s ease-in-out infinite;
-moz-animation:balloon1 6s ease-in-out infinite;
-o-animation:balloon1 6s ease-in-out infinite;
animation:balloon1 6s ease-in-out infinite;
&:before {
color: rgba(182, 15, 97, 0.9) ;
}
}
.balloon > div:nth-child(2){
background: rgba(242, 112, 45, 0.9);
left: 120px;
box-shadow:inset 10px 10px 10px darken(rgba(242, 112, 45, 0.9), 10%);
-webkit-animation:balloon2 6s ease-in-out infinite;
-moz-animation:balloon2 6s ease-in-out infinite;
-o-animation:balloon2 6s ease-in-out infinite;
animation:balloon2 6s ease-in-out infinite;
&:before {
color: rgba(242, 112, 45, 0.9) ;
}
}
.balloon > div:nth-child(3){
background: rgba(45, 181, 167, 0.9);
left: 240px;
box-shadow:inset 10px 10px 10px darken(rgba(45, 181, 167, 0.9), 10%);
-webkit-animation:balloon4 6s ease-in-out infinite;
-moz-animation:balloon4 6s ease-in-out infinite;
-o-animation:balloon4 6s ease-in-out infinite;
animation:balloon4 6s ease-in-out infinite;
&:before {
color: rgba(45, 181, 167, 0.9) ;
}
}
.balloon > div:nth-child(4){
background: rgba(190, 61, 244, 0.9);
left: 360px;
box-shadow:inset 10px 10px 10px darken(rgba(190, 61, 244, 0.9), 10%);
-webkit-animation:balloon1 5s ease-in-out infinite;
-moz-animation:balloon1 5s ease-in-out infinite;
-o-animation:balloon1 5s ease-in-out infinite;
animation:balloon1 5s ease-in-out infinite;
&:before {
color: rgba(190, 61, 244, 0.9) ;
}
}
.balloon > div:nth-child(5){
background: rgba(180, 224, 67, 0.9);
left: 480px;
box-shadow:inset 10px 10px 10px darken(rgba(180, 224, 67, 0.9), 10%);
-webkit-animation:balloon3 5s ease-in-out infinite;
-moz-animation:balloon3 5s ease-in-out infinite;
-o-animation:balloon3 5s ease-in-out infinite;
animation:balloon3 5s ease-in-out infinite;
&:before {
color: rgba(180, 224, 67, 0.9) ;
}
}
.balloon > div:nth-child(6){
background: rgba(242, 194, 58, 0.9);
left: 600px;
box-shadow:inset 10px 10px 10px darken(rgba(242, 194, 58, 0.9), 10%);
-webkit-animation:balloon2 3s ease-in-out infinite;
-moz-animation:balloon2 3s ease-in-out infinite;
-o-animation:balloon2 3s ease-in-out infinite;
animation:balloon2 3s ease-in-out infinite;
&:before {
color: rgba(242, 194, 58, 0.9) ;
}
}
.balloon > div:before {
color:rgba(182, 15, 97, 0.9);
position:absolute;
bottom:-11px;
left: 52px;
content:"▲";
font-size:1em;
}
.balloon span {
font-size: 4.8em;
color: white;
position: relative;
top: 30px;
left: 50%;
margin-left: -27px;
}
/* RWD */
@media (max-width: 768px) {
.balloon > div:nth-child(2),
.balloon > div:nth-child(3),
.balloon > div:nth-child(4),
.balloon > div:nth-child(5),
.balloon > div:nth-child(6){
display: none;
}
}
/*BALLOON 1 4*/
@-webkit-keyframes balloon1 {
0%,100%{ -webkit-transform:translateY(0) rotate(-6deg);}
50%{ -webkit-transform:translateY(-20px) rotate(8deg); }
}
@-moz-keyframes balloon1 {
0%,100%{ -moz-transform:translateY(0) rotate(-6deg);}
50%{ -moz-transform:translateY(-20px) rotate(8deg); }
}
@-o-keyframes balloon1 {
0%,100%{ -o-transform:translateY(0) rotate(-6deg);}
50%{ -o-transform:translateY(-20px) rotate(8deg); }
}
@keyframes balloon1 {
0%,100%{ transform:translateY(0) rotate(-6deg);}
50%{ transform:translateY(-20px) rotate(8deg); }
}
/* BAllOON 2 5*/
@-webkit-keyframes balloon2 {
0%,100%{ -webkit-transform:translateY(0) rotate(6eg);}
50%{ -webkit-transform:translateY(-30px) rotate(-8deg); }
}
@-moz-keyframes balloon2 {
0%,100%{ -moz-transform:translateY(0) rotate(6deg);}
50%{ -moz-transform:translateY(-30px) rotate(-8deg); }
}
@-o-keyframes balloon2 {
0%,100%{ -o-transform:translateY(0) rotate(6deg);}
50%{ -o-transform:translateY(-30px) rotate(-8deg); }
}
@keyframes balloon2 {
0%,100%{ transform:translateY(0) rotate(6deg);}
50%{ transform:translateY(-30px) rotate(-8deg); }
}
/* BAllOON 0*/
@-webkit-keyframes balloon3 {
0%,100%{ -webkit-transform:translate(0, -10px) rotate(6eg);}
50%{ -webkit-transform:translate(-20px, 30px) rotate(-8deg); }
}
@-moz-keyframes balloon3 {
0%,100%{ -moz-transform:translate(0, -10px) rotate(6eg);}
50%{ -moz-transform:translate(-20px, 30px) rotate(-8deg); }
}
@-o-keyframes balloon3 {
0%,100%{ -o-transform:translate(0, -10px) rotate(6eg);}
50%{ -o-transform:translate(-20px, 30px) rotate(-8deg); }
}
@keyframes balloon3 {
0%,100%{ transform:translate(0, -10px) rotate(6eg);}
50%{ transform:translate(-20px, 30px) rotate(-8deg); }
}
/* BAllOON 3*/
@-webkit-keyframes balloon4 {
0%,100%{ -webkit-transform:translate(10px, -10px) rotate(-8eg);}
50%{ -webkit-transform:translate(-15px, 20px) rotate(10deg); }
}
@-moz-keyframes balloon4 {
0%,100%{ -moz-transform:translate(10px, -10px) rotate(-8eg);}
50%{ -moz-transform:translate(-15px, 10px) rotate(10deg); }
}
@-o-keyframes balloon4 {
0%,100%{ -o-transform:translate(10px, -10px) rotate(-8eg);}
50%{ -o-transform:translate(-15px, 10px) rotate(10deg); }
}
@keyframes balloon4 {
0%,100%{ transform:translate(10px, -10px) rotate(-8eg);}
50%{ transform:translate(-15px, 10px) rotate(10deg); }
}
.container h1 {
position:relative;
top: 200px;
text-align: center;
color: rgba(182, 15, 97, 0.9);
font-size: 3.5em;
}
.container img{
width: 50%;
display: block;
margin-left: auto;
margin-right: auto;
}
</style>
<div class="container">
<div class="balloon">
<div><span>☺</span></div>
<div><span>Y</span></div>
<div><span>A</span></div>
<div><span>~</span></div>
<div><span>~</span></div>
<div><span>!</span></div>
</div>
</div>