esther-anniversary / scripts.js
Lightified's picture
Update scripts.js
9a66798 verified
// floating hearts
setInterval(()=>{
let heart=document.createElement("div")
heart.className="heart"
heart.innerHTML="❤️"
heart.style.left=Math.random()*100+"vw"
heart.style.fontSize=(10+Math.random()*30)+"px"
document.body.appendChild(heart)
setTimeout(()=>heart.remove(),6000)
},300)
// python typewriter animation
let code = `# Love Program
girl = "Esther"
boy = "Adedeji"
months = 6
for m in range(months):
print("Thank you for every beautiful moment ❤️")
print("Happy 6 Months My Love 💕")
`
let i=0
function type(){
if(i < code.length){
document.getElementById("code").innerHTML += code.charAt(i)
i++
setTimeout(type,40)
}
}
type()
// slideshow
let images=["esther.png","adedeji.png"]
let index=0
setInterval(()=>{
index=(index+1)%images.length
document.getElementById("slide").src=images[index]
},3000)
// countdown
let target=new Date("Oct 26, 2026 00:00:00")
setInterval(()=>{
let now=new Date()
let diff=target-now
let days=Math.floor(diff/(1000*60*60*24))
let hours=Math.floor((diff%(1000*60*60*24))/(1000*60*60))
let mins=Math.floor((diff%(1000*60*60))/(1000*60))
let sec=Math.floor((diff%(1000*60))/1000)
document.getElementById("countdown").innerHTML =
days+"d "+hours+"h "+mins+"m "+sec+"s"
},1000)