- 세상의 모든 계산기 자유(질문) 게시판 일반 ()
불티 움직임 시뮬레이션 (html5)

<!DOCTYPE html>
<html>
<head>
<style>
body {
background: #1a1a1a;
color: #fff;
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
display: flex;
flex-direction: column;
align-items: center;
}
canvas {
background: #1a1a1a;
border: 1px solid #333;
margin: 20px 0;
}
.controls {
background: rgba(0, 0, 0, 0.7);
padding: 20px;
border-radius: 10px;
width: 380px;
}
.control-group {
margin: 15px 0;
}
.control-group label {
display: block;
margin-bottom: 5px;
color: #ffa500;
}
.slider-container {
display: flex;
align-items: center;
gap: 10px;
}
input[type="range"] {
flex: 1;
height: 10px;
-webkit-appearance: none;
background: #333;
border-radius: 5px;
outline: none;
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
width: 20px;
height: 20px;
background: #ffa500;
border-radius: 50%;
cursor: pointer;
}
.value-display {
min-width: 50px;
text-align: center;
background: #333;
padding: 5px;
border-radius: 3px;
}
</style>
</head>
<body>
<canvas id="sparkCanvas"></canvas>
<div class="controls">
<div class="control-group">
<label>크기 배율 (Size Scale)</label>
<div class="slider-container">
<input type="range" id="sizeScale" min="0.5" max="3" step="0.1" value="1">
<span class="value-display" id="sizeValue">1</span>
</div>
</div>
<div class="control-group">
<label>온도 배율 (Temperature Scale)</label>
<div class="slider-container">
<input type="range" id="tempScale" min="0.5" max="2" step="0.1" value="1">
<span class="value-display" id="tempValue">1</span>
</div>
</div>
<div class="control-group">
<label>무게 배율 (Weight Scale)</label>
<div class="slider-container">
<input type="range" id="weightScale" min="0.5" max="2" step="0.1" value="1">
<span class="value-display" id="weightValue">1</span>
</div>
</div>
<div class="control-group">
<label>수명 배율 (Life Scale)</label>
<div class="slider-container">
<input type="range" id="lifeScale" min="0.5" max="2" step="0.1" value="1">
<span class="value-display" id="lifeValue">1</span>
</div>
</div>
</div>
<script>
const canvas = document.getElementById('sparkCanvas');
const ctx = canvas.getContext('2d');
// 캔버스 크기 설정
canvas.width = 400;
canvas.height = 600;
// 컨트롤 요소
const controls = {
sizeScale: document.getElementById('sizeScale'),
tempScale: document.getElementById('tempScale'),
weightScale: document.getElementById('weightScale'),
lifeScale: document.getElementById('lifeScale')
};
// 값 표시 요소
const displays = {
sizeValue: document.getElementById('sizeValue'),
tempValue: document.getElementById('tempValue'),
weightValue: document.getElementById('weightValue'),
lifeValue: document.getElementById('lifeValue')
};
// 컨트롤 값 업데이트 함수
Object.keys(controls).forEach(key => {
controls[key].addEventListener('input', (e) => {
displays[key.replace('Scale', 'Value')].textContent = e.target.value;
});
});
class Spark {
constructor() {
this.reset();
}
reset() {
this.x = canvas.width/2 + (Math.random() * 40 - 20);
this.y = canvas.height - 20;
// 슬라이더 값을 반영한 특성 설정
this.baseSize = Math.random() * 3 + 1;
this.size = this.baseSize * parseFloat(controls.sizeScale.value);
this.baseTemp = Math.random() * 0.5 + 0.5;
this.temperature = this.baseTemp * parseFloat(controls.tempScale.value);
this.baseWeight = Math.random() * 0.3 + 0.1;
this.weight = this.baseWeight * parseFloat(controls.weightScale.value);
this.vx = 0;
this.vy = -2 - (this.temperature * 2);
this.baseLife = 1.0;
this.life = this.baseLife * parseFloat(controls.lifeScale.value);
this.color = `rgba(255, ${150 + Math.random() * 105}, 0, ${this.life})`;
}
update() {
// 현재 슬라이더 값으로 특성 업데이트
this.size = this.baseSize * parseFloat(controls.sizeScale.value);
this.temperature = this.baseTemp * parseFloat(controls.tempScale.value);
this.weight = this.baseWeight * parseFloat(controls.weightScale.value);
this.vx += Math.sin(Date.now() * 0.001) * 0.1 * this.weight;
this.x += this.vx;
this.y += this.vy * this.temperature;
this.life -= 0.005 / parseFloat(controls.lifeScale.value);
this.size *= 0.999;
if (this.life <= 0 || this.y < 0 || this.x < 0 || this.x > canvas.width) {
this.reset();
}
this.color = `rgba(255, ${150 + Math.random() * 105}, 0, ${this.life})`;
}
draw() {
ctx.beginPath();
ctx.fillStyle = this.color;
ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
ctx.fill();
}
}
const sparks = Array(50).fill().map(() => new Spark());
function animate() {
ctx.fillStyle = 'rgba(26, 26, 26, 0.2)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
sparks.forEach(spark => {
spark.update();
spark.draw();
});
requestAnimationFrame(animate);
}
animate();
</script>
</body>
</html>
세상의모든계산기 님의 최근 댓글
Ctrl+Z 를 이용해 뒤로 돌아기기 Undo 기능이 있는지 살펴보세요. 2026 01.23 쌀집계산기로 연립방정식 계산하기 - 크래머/크레이머/크라메르 공식 적용 https://allcalc.org/56739 3. 'x' 값 구하기 계산기 조작법 목표: x = Dx / D = [(c×e) - (b×f)] / [(a×e) - (b×d)] 계산하기 1단계: 분모 D 계산 (메모리 활용) 1 * 1 M+ : 메모리(M)에 1를 더합니다. (현재 M = 1) -0.1 * -0.2 M- : 메모리(M)에서 0.02를 뺍니다. (현재 M = 0.98 = 0.98) 이로써 메모리(MR)에는 분모 0.98가 저장됩니다. 2단계: 분자 Dx 계산 후 나누기 78000 * 1 : 78000를 계산합니다. = : GT에 더합니다. -0.1 * 200000 : -20000를 계산합니다. ± = : 부호를 뒤집어 GT에 넣습니다. // sign changer 버튼 사용 GT : GT를 불러옵니다. GT는 98000 (분자 Dx) 값입니다. ÷ MR = : 위 결과(98000)를 메모리(MR)에 저장된 분모 D(0.98)로 나누어 최종 x값 100,000를 구합니다. 4. 'y' 값 구하기 계산기 조작법 목표: y = Dy / D = [(a×f) - (c×d)] / [(a×e) - (b×d)] 계산하기 1단계: 분모 D 계산 (메모리 활용) 'x'에서와 분모는 동일하고 메모리(MR)에 0.98가 저장되어 있으므로 패스합니다. 2단계: 분자 Dy 계산 후 나누기 GT ± = : GT를 불러오고 부호를 뒤집어 GT에 더합니다. GT가 0으로 리셋됩니다. 【AC】를 누르면 M은 유지되고 GT만 리셋되는 계산기도 있으니 확인해 보세요. 1 * 200000 : 200000를 계산합니다. = : GT에 더합니다. 78000 * -0.2 : -15600를 계산합니다. ± = : 부호를 뒤집어 GT에 넣습니다. GT : GT를 불러옵니다. 215600 (분자 Dy) 값입니다. ÷ MR = : 위 결과(215600)를 메모리(MR)에 저장된 분모 D(0.98)로 나누어 최종 y값 220,000를 구합니다. x, y 값을 이용해 최종 결과를 구합니다. 2026 01.18 크레이머 = 크레머 = 크라메르 공식 = Cramer's Rule https://allcalc.org/8985 2026 01.18 부호 변경, Sign Changer 버튼 https://allcalc.org/52092 2026 01.18 [fx-570 CW] 와의 차이 CW에 【×10x】버튼이 사라진 것은 아닌데, 버튼을 누를 때 [ES][EX] 처럼 특수기호 뭉치가 생성되는 것이 아니고, 【×】【1】【0】【xㅁ】 버튼이 차례로 눌린 효과가 발생됨. ※ 계산 우선순위 차이가 발생할 수 있으므로 주의. 괄호로 해결할 것! 2026 01.18