I am developing a Sunrise and Sunset animation with CSS3, Please check runtime jsFiddle output.
Sun is transiting from one color to another color as expected
Noon
After Noon
Evening
Night
Early Morning
Problem lies in Sky transition from one mode to another mode, the color changes are abrupt and are not linear
Code Used for Sky Color Change
@-webkit-keyframes changeSkyColor /* Safari and Chrome */
{
1%{
background: -webkit-linear-gradient(top, rgba(30, 152, 209, 1) 0%,rgb(202, 229, 243) 40%,rgba(125, 185, 232, 0.82) 100%); /* Background of Sky */
}
11%{
background: -webkit-linear-gradient(top, rgba(30, 152, 209, 1) 0%,rgb(202, 229, 243) 40%,rgba(125, 185, 232, 0.82) 100%); /* Background of Sky */
}
33% {
background: -webkit-linear-gradient(top, rgb(240, 231, 26) 0%,rgb(245, 86, 12) 50%,rgba(197, 127, 81, 0.82) 100%); /* Background of Sky */
}
66% {
background: -webkit-linear-gradient(top, rgb(34, 33, 3) 0%,rgb(162, 55, 5) 50%,rgb(24, 10, 1) 100%); /* Background of Sky */
}
100% {
background: -webkit-linear-gradient(top, rgba(5, 5, 5, 1) 0%,rgb(54, 55, 56) 40%,rgb(3, 3, 3) 100%); /* Background of Sky */
}
}
Please Check JsFiddle Code(It is with comments).
- Are we not supposed to use linear-gradient in Animations?
- If so, How to make Sky Color transit Smoothly?
Is there some thing i am missing? I Would be thankful if some one can give me some references or any pointers to take it forward.