For all those who ever wanted to add a fade effect to their games; Here you go, paste this in style.css in your mygame folder, make sure to paste it over the “body” paragraph at the beginning to get the desired effect:
Here’s how it should look:
body {
max-width: 680px;
font-family: Georgia,“Times New Roman”,serif;
font-size: 16px; /* reset, specified in px so IE currentStyle works */
background-color: #F7F4F1;
color: rgba(0, 0, 0, 0.85);
margin: 8px auto;
padding: 0 8px;
-webkit-user-select: text; /* selectable text for Chrome app support */
-webkit-animation: fadein 3s; /* Safari and Chrome */
-moz-animation: fadein 3s; /* Firefox */
-ms-animation: fadein 3s; /* Internet Explorer */
-o-animation: fadein 3s; /* Opera */
animation: fadein 3s;
}
@keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
}
/* Firefox */
@-moz-keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
}
/* Safari and Chrome */
@-webkit-keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
}
/* Internet Explorer */
@-ms-keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
}
/* Opera */
@-o-keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
}
}
Happy Coding!