호박이 떨어진다! 🎃
3847 단어 webdevjavascripthalloweenhtml
2021년 해피 할로윈!
나는 나 자신에게 도전했고 할로윈과 Canvas과 관련된 작은 프로젝트를 코딩하기로 결정했습니다!
색종이 🎊
저는 캔버스에서 임의 입자 생성기를 얻는 방법을 찾고 있었고 이 프로젝트에 널리 영감을 준 이 훌륭한 도구confetti-js를 발견했습니다.
할로윈-2021
거의 모든 것이 앱 구성에 있습니다.
const app = {
target: 'canvas',
images: ['./images/bat.png', './images/pumpkin.png', './images/sweet.png'],
max: 30,
speed: 3,
width: window.innerWidth,
height: window.innerHeight,
imageMinWidth: 30,
imageMaxWidth: 100,
}
한 가지 유용한 기능:
function getRandomInt(min, max) {
min = Math.ceil(min)
max = Math.floor(max)
return Math.floor(Math.random() * (max - min + 1)) + min
}
데모 및 코드(무서울 수도 있음 😱)를 사용할 수 있습니다.
데모: https://0kyn.github.io/halloween-2021/
출처: https://github.com/0kyn/halloween-2021
Reference
이 문제에 관하여(호박이 떨어진다! 🎃), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://dev.to/0kyn/pumpkins-fall-43dg
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
const app = {
target: 'canvas',
images: ['./images/bat.png', './images/pumpkin.png', './images/sweet.png'],
max: 30,
speed: 3,
width: window.innerWidth,
height: window.innerHeight,
imageMinWidth: 30,
imageMaxWidth: 100,
}
function getRandomInt(min, max) {
min = Math.ceil(min)
max = Math.floor(max)
return Math.floor(Math.random() * (max - min + 1)) + min
}
Reference
이 문제에 관하여(호박이 떨어진다! 🎃), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/0kyn/pumpkins-fall-43dg텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)