Latihan 1 dari materi CSS Keyframes di Web Animation — praktek dengan editor kode interaktif, test case otomatis, dan hint terpandu. Langsung jalan di browser.
Buat function buildKeyframes(name, steps) yang menghasilkan string @keyframes CSS.
Parameter steps adalah array of objects { percent, properties } di mana properties adalah object CSS.
Contoh:
buildKeyframes("fadeIn", [
{ percent: 0, properties: { opacity: 0 } },
{ percent: 100, properties: { opacity: 1 } }
])
Harus menghasilkan:
@keyframes fadeIn { 0% { opacity: 0; } 100% { opacity: 1; } }
Lalu buat function buildAnimationShorthand(name, duration, easing, iterationCount) yang mengembalikan string animation shorthand CSS.