고성능 러닝머신 칼로리 코어 스위트 (Vanilla JS) 를 구축한 방법

작성자

카테고리:

← 피드로
DEV Community · Farhan Adil · 2026-07-09 개발(SW)

Farhan Adil

Frustrated by slow, bloated online calculators covered in dozens of flashing display ads, I decided to build a high-performance alternative from scratch: TreadmillCalc

To keep the platform instantly interactive, I intentionally bypassed heavy frameworks and coded the calculation suite entirely in Vanilla JavaScript.

The engine uses the exact American College of Sports Medicine (ACSM) metabolic equations to compute raw, scientifically backed calorie expenditure based on weight, speed, duration, and gradient incline.

Here is the core logic handling the real-time calculations:


javascript
function calculateTreadmillKcal(weightKg, speedMph, inclinePercent, durationMins) {
    const speedMpm = speedMph * 26.8; 
    const grade = inclinePercent / 100; 
    let vo2 = 0;

    if (speedMph <= 3.7) {
        vo2 = (0.1 * speedMpm) + (1.8 * speedMpm * grade) + 3.5; // Walking
    } else {
        vo2 = (0.2 * speedMpm) + (0.9 * speedMpm * grade) + 3.5; // Running
    }

    const kcalPerMin = (vo2 * weightKg) / 200;
    return parseFloat((kcalPerMin * durationMins).toFixed(1));
}

Enter fullscreen mode Exit fullscreen mode

원문에서 계속 ↗

코멘트

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다