ECC RELATED VERSION-1 SOURCE CODE

 <div style="font-family:Arial, Helvetica, sans-serif; line-height:1.7; max-width:1000px; margin:auto; padding:20px; background:#fdfdfd; border:1px solid #ccc; border-radius:8px;">


<h2 style="color:#2a5db0;">Body Roll (Limbung) & EXTREME All-in-One Simulator (EEC / EU Type Approval)</h2>


<p>

Simulasi lengkap Body Roll: kendaraan bergerak, bodi miring sesuai roll angle, panah gaya mengikuti, dashboard + numeric real-time, dan chart line update real-time.

</p>


<hr />


<h3 style="color:#2a5db0;">1. Diagram SVG + Animasi Kendaraan + Panah Gaya</h3>

<svg id="simSVG" width="100%" height="300px" viewBox="0 0 1000 300">

  <!-- Lintasan spline -->

  <path id="track" d="M50 250 Q250 50 450 250 T850 250" stroke="#999" stroke-width="2" fill="none"/>


  <!-- Kendaraan + roll -->

  <g id="car">

    <rect x="-15" y="-7" width="30" height="14" fill="#2a5db0" rx="3"/>

    <!-- Panah gaya lateral -->

    <line x1="0" y1="0" x2="25" y2="0" stroke="red" stroke-width="3" marker-end="url(#arrowhead)"/>

  </g>


  <defs>

    <marker id="arrowhead" markerWidth="10" markerHeight="7" refX="0" refY="3.5" orient="auto">

      <polygon points="0 0, 10 3.5, 0 7" fill="red"/>

    </marker>

  </defs>

</svg>


<hr />


<h3 style="color:#2a5db0;">2. Dashboard + Numeric Indicators</h3>

<div style="display:flex; justify-content:space-around; background:#eef; padding:10px; border-radius:8px; flex-wrap:wrap;">

  <div>

    <b>Lateral Force (Fy)</b> <span id="numFy">0 N</span><br>

    <div style="width:120px; height:20px; background:#ccc; border-radius:5px; overflow:hidden;">

      <div id="barFy" style="width:50%; height:100%; background:red;"></div>

    </div>

  </div>

  <div>

    <b>Roll Angle</b> <span id="numRoll">0°</span><br>

    <div style="width:120px; height:20px; background:#ccc; border-radius:5px; overflow:hidden;">

      <div id="barRoll" style="width:30%; height:100%; background:green;"></div>

    </div>

  </div>

  <div>

    <b>Yaw Moment</b> <span id="numYaw">0 Nm</span><br>

    <div style="width:120px; height:20px; background:#ccc; border-radius:5px; overflow:hidden;">

      <div id="barYaw" style="width:40%; height:100%; background:orange;"></div>

    </div>

  </div>

</div>


<hr />


<h3 style="color:#2a5db0;">3. Real-Time Line Chart</h3>

<canvas id="chart" width="950" height="300" style="background:#f4f4f4; border:1px solid #ccc; border-radius:8px;"></canvas>


<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>

<script>

// Setup Chart

const ctx = document.getElementById('chart').getContext('2d');

const chart = new Chart(ctx, {

    type: 'line',

    data: {

        labels: Array.from({length:50}, (_,i)=>i),

        datasets: [

            {label:'Lateral Force (Fy)', data:Array(50).fill(0), borderColor:'red', fill:false},

            {label:'Roll Angle', data:Array(50).fill(0), borderColor:'green', fill:false},

            {label:'Yaw Moment', data:Array(50).fill(0), borderColor:'orange', fill:false}

        ]

    },

    options: {animation:false, responsive:true, scales:{y:{beginAtZero:true}}}

});


// Kendaraan SVG

const car = document.getElementById('car');

const path = document.getElementById('track');

const pathLength = path.getTotalLength();


let t = 0; // progress along track


function updateSimulator() {

    // Generate random data

    const Fy = Math.floor(Math.random()*1000);

    const Roll = Math.floor(Math.random()*10);

    const Yaw = Math.floor(Math.random()*500);


    // Update numeric dashboard

    document.getElementById('numFy').innerText = Fy + ' N';

    document.getElementById('barFy').style.width = (Fy/1000*100)+'%';

    document.getElementById('numRoll').innerText = Roll + '°';

    document.getElementById('barRoll').style.width = (Roll/10*100)+'%';

    document.getElementById('numYaw').innerText = Yaw + ' Nm';

    document.getElementById('barYaw').style.width = (Yaw/500*100)+'%';


    // Update chart

    chart.data.datasets[0].data.push(Fy); chart.data.datasets[0].data.shift();

    chart.data.datasets[1].data.push(Roll); chart.data.datasets[1].data.shift();

    chart.data.datasets[2].data.push(Yaw); chart.data.datasets[2].data.shift();

    chart.update();


    // Update car position along path

    t += 0.01;

    if (t>1) t=0;

    const pos = path.getPointAtLength(t * pathLength);

    const next = path.getPointAtLength(Math.min(t*pathLength+1,pathLength));

    const angle = Math.atan2(next.y-pos.y, next.x-pos.x) * 180 / Math.PI;


    car.setAttribute('transform', `translate(${pos.x},${pos.y}) rotate(${angle + Roll})`);

}


setInterval(updateSimulator, 1000);

</script>


<hr />


<h3 style="color:#2a5db0;">4. Kesimpulan</h3>

<p>

Versi EXTREME NEXT LEVEL ALL-IN-ONE menampilkan:

<ul>

<li>Kendaraan bergerak mengikuti lintasan</li>

<li>Bodi kendaraan miring sesuai roll angle</li>

<li>Panah gaya lateral bergerak sinkron</li>

<li>Dashboard numeric real-time (Lateral Force, Roll Angle, Yaw Moment)</li>

<li>Real-time line chart untuk semua parameter</li>

<li>Simulasi interaktif mirip software profesional, 100% aman untuk Blogger / Blogspot</li>

</ul>

</p>


</div>

Comments