[Spring Limited] Sakura Collection Smartphone Case

#main { position: relative; width: 100%; overflow: hidden; } #main .petal { position: absolute; background-color: #F9C3BE; border-radius: 150% 0 150% 0; z-index: 10; animation: animate-petal 100s linear; } #main .petal::after { content: ""; position: absolute; top: -14%; left: -10%; display: block; width: 100%; height: 100%; background-color: #F9C3BE; border-radius: 150% 0 150% 0; transform: rotate(15deg); } @keyframes animate-petal { 0% { top: 0; opacity: 0; transform: rotate(0deg); } 2.5% { opacity: 1; } 10% { opacity: 1; } 90% { opacity: 1; } 100% { opacity: 0; top: 100%; transform: rotate(3000deg); } } The cherry blossom pink reflects the lightness shown by the petals swaying in the wind. /* 実行(SAKURA) ————————————————————————————— */ window.addEventListener(’DOMContentLoaded’, () ⇒ { const section = document.querySelector(’#main’); const createPetal = () ⇒ { const petalEl = document.createElement(’span’); petalEl.className = 'petal’; const minSize = 10; const maxSize = 15; const size = Math.random() * (maxSize + 1 - minSize) + minSize; petalEl.style.width = `${size}px`; petalEl.style.height = `${size}px`; petalEl.style.left = Math.random() * innerWidth + 'px’; section.appendChild(petalEl); setTimeout(() ⇒ { petalEl.remove(); }, 1000000); } setInterval(createPetal, 300); });