I am working on an animation that I can't seem to get it anything I am trying to do. I am trying to show a red dot turn into three stars and for the stars to end in separate places. I am running into three main issues.
I can't get more than one star to show up.
I want the star from 10% - 100% to show sliding into place. Right now it shows in position at 10%, then at the final point.
The red dot shows the image of the star, so the image is taking place before the percentage I introduce it.
Does anyone see anything I am doing wrong to create these errors.
Note - I only have CSS for two stars at this point.
body {
background-color: #F5F5F5;
color: #555;
height: 100vh;
width: 100%;
font-size: 1.1em;
font-family: 'Lato', sans-serif;
}
.star-container {
background-color: green;
color: white;
width: 70%;
height: 80%;
margin: 10% auto;
text-align: justify;
position: relative;
}
.star1 {
width: 250px;
height: 250px;
text-align: justify;
-webkit-animation-name: star1;
-webkit-animation-duration: 4s;
-webkit-animation-iteration-count: 1;
-webkit-animation-fill-mode: forwards;
/*-webkit-animation-timing-function: linear;*/
animation-name: star1;
animation-duration: 4s;
animation-iteration-count: 1;
animation-fill-mode: forwards;
/*animation-timing-function: linear;*/
}
/* Chrome, Safari, Opera */
@-webkit-keyframes star1 {
0%,
5% {
background-color: red;
position: absolute;
left: 50%;
top: 50%;
height: 50px;
width: 50px;
border-radius: 50%;
background-image: none;
}
5.1%,
10% {
background-color: red;
position: absolute;
left: 50%;
top: 90%;
height: 50px;
width: 50px;
border-radius: 50%;
background-image: none;
}
10.1% {
background-image: url('http://optimumwebdesigns.com/images/star.png');
background-repeat: no-repeat;
background-size: 100%;
height: 50px;
width: 50px;
}
100% {
background-image: url('http://optimumwebdesigns.com/images/star.png');
background-repeat: no-repeat;
background-size: 100%;
height: 50px;
width: 50px;
}
/* Standard syntax */
@keyframes star1 {
0%,
5% {
background-color: red;
position: absolute;
left: 50%;
top: 50%;
height: 50px;
width: 50px;
border-radius: 50%;
}
5.1%,
10% {
background-color: red;
position: absolute;
left: 50%;
top: 90%;
height: 50px;
width: 50px;
border-radius: 50%;
}
10.1% {
background-image: url('http://optimumwebdesigns.com/images/star.png');
background-repeat: no-repeat;
background-size: 100%;
height: 50px;
width: 50px;
}
100% {
background-image: url('http://optimumwebdesigns.com/images/star.png');
background-repeat: no-repeat;
background-size: 100%;
height: 50px;
width: 50px;
}
}
.star2 {
width: 200px;
height: 200px;
text-align: justify;
-webkit-animation-name: star2;
-webkit-animation-duration: 4s;
-webkit-animation-iteration-count: 1;
-webkit-animation-fill-mode: forwards;
/*-webkit-animation-timing-function: linear;*/
animation-name: star2;
animation-duration: 4s;
animation-iteration-count: 1;
animation-fill-mode: forwards;
/*animation-timing-function: linear;*/
}
/* Chrome, Safari, Opera */
@-webkit-keyframes star2 {
0%,
5% {
background-color: red;
position: absolute;
left: 50%;
top: 50%;
height: 40px;
width: 40px;
border-radius: 50%;
background-image: none;
}
5.1%,
10% {
background-color: red;
position: absolute;
left: 50%;
top: 90%;
height: 40px;
width: 40px;
border-radius: 50%;
background-image: none;
}
10.1%,
100% {
background-image: url('http://optimumwebdesigns.com/images/star.png');
background-repeat: no-repeat;
background-size: 100%;
height: 40px;
width: 40px;
top: 5%;
right: 5%;
}
/* Standard syntax */
@keyframes star2 {
0%,
5% {
background-color: red;
position: absolute;
left: 50%;
top: 50%;
height: 40px;
width: 40px;
border-radius: 50%;
}
5.1%,
10% {
background-color: red;
position: absolute;
left: 50%;
top: 90%;
height: 40px;
width: 40px;
border-radius: 50%;
}
10.1%,
100% {
background-image: url('http://optimumwebdesigns.com/images/star.png');
background-repeat: no-repeat;
background-size: 100%;
height: 40px;
width: 40px;
top: 5%;
right: 5%;
}
}
<div class="star-container">
<div class="star1"></div>
<div class="star2"></div>
<div class="star3"></div>
</div>