The Unicef animation project incorporates a combination of JavaScript with GSAP JS library and CSS Transitions.
If you want to delve into their code, you can check out the bundle.js and screen.css files using Chrome developer tools.
Here are some techniques you can use:
- CSS Keyframe Animation
- CSS Transitions
- JavaScript vanilla or utilizing libraries
- Web Animation API
To aid in getting started, I created a simple scale/zoom effect using CSS Keyframe Animation. However, similar effects can be achieved through JavaScript libraries like jQuery, GSAP, Velocity, and others.
For more intricate animations, it is recommended to use specialized JS libraries such as GSAP. On the other hand, for simpler, eye-catching animations, pre-made effects could be considered:
- animate.css (CSS Keyframe Animation)
- animatelo.js (Web Animation API) - disclaimer: This library was created by me :)
The choice between these options depends on the complexity of your animation and your proficiency level.
#mario {
background: url(http://vignette1.wikia.nocookie.net/the-new-super-mario-bros/images/7/7e/200px-Mario_Nintendo.png/revision/latest?cb=20140505185215);
background-repeat: no-repeat;
width: 375px;
height: 375px;
-webkit-transform-origin: 0 0;
-ms-transform-origin: 0 0;
transform-origin: 0 0;
-webkit-animation: leaves 5s ease-in-out infinite alternate;
animation: marioAnim 5s ease-in-out infinite alternate;
}
@-webkit-keyframes marioAnim {
0% {
-webkit-transform: scale(1.0);
}
100% {
-webkit-transform: scale(2.0);
}
}
@keyframes leaves {
0% {
transform: scale(1.0);
}
100% {
transform: scale(2.0);
}
}
<div id="mario"></div>