Here is a single-file HTML demo that gives you high-velocity particles plus live toggles for every important parameter.
Copy-paste into hv-particles.html, open in any browser, and use the on-screen panel to tweak the simulation in real time.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>High-Velocity Particle Playground</title>
<style>
body{margin:0;overflow:hidden;background:#000;color:#fff;font-family:sans-serif}
#gui{position:absolute;top:10px;left:10px;background:rgba(0,0,0,.6);padding:10px;border-radius:6px;font-size:13px;line-height:1.4}
label{display:block;margin:4px 0}
input[type=range]{width:120px}
span.value{display:inline-block;width:40px;text-align:right}
</style>
</head>
<body>
<div id="gui">
<label>Count <input id="count" type="range" min="100" max="5000" value="800"><span id="countVal" class="value">800</span></label>
<label>Speed <input id="speed" type="range" min="0.05" max="2" step="0.05" value="0.8"><span id="speedVal" class="value">0.8</span></label>
<label>Gravity <input id="grav" type="range" min="0" max="0.5" step="0.01" value="0.08"><span id="gravVal" class="value">0.08</span></label>
<label>Drag <input id="drag" type="range" min="0.85" max="1" step="0.005" value="0.985"><span id="dragVal" class="value">0.985</span></label>
<label>Swirl <input id="swirl" type="range" min="0" max="0.5" step="0.01" value="0.25"><span id="swirlVal" class="value">0.25</span></label>
<label>Disk Tilt <input id="tilt" type="range" min="0" max="1" step="0.01" value="0"><span id="tiltVal" class="value">0</span></label>
<label>Reset <button id="resetBtn">Reset</button></label>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r134/three.min.js"></script>
<script>
/* ---------- GUI wiring ---------- */
const gui = {
count: document.getElementById('count'),
speed: document.getElementById('speed'),
grav: document.getElementById('grav'),
drag: document.getElementById('drag'),
swirl: document.getElementById('swirl'),
tilt: document.getElementById('tilt'),
resetBtn: document.getElementById('resetBtn')
};
['count','speed','grav','drag','swirl','tilt'].forEach(k=>{
gui[k].addEventListener('input', e=>{
document.getElementById(k+'Val').textContent = e.target.value;
if(k==='count') rebuildSystem();
});
});
gui.resetBtn.addEventListener('click', rebuildSystem);
/* ---------- Three setup ---------- */
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75,innerWidth/innerHeight,0.1,1000);
const renderer = new THREE.WebGLRenderer({antialias:true});
renderer.setSize(innerWidth,innerHeight);
document.body.appendChild(renderer.domElement);
camera.position.set(0,15,35);
camera.lookAt(0,0,0);
let points, geo, pos, vel, N;
/* ---------- simulation ---------- */
function rebuildSystem(){
N = parseInt(gui.count.value);
if(points) scene.remove(points);
geo = new THREE.BufferGeometry();
pos = new Float32Array(N*3);
vel = new Float32Array(N*3);
for(let i=0;i<N;i++){
const r = 5 + Math.random()*10;
const theta = Math.random()*Math.PI*2;
const phi = (Math.random()-0.5)*Math.PI*0.4;
pos[i*3] = r*Math.cos(theta)*Math.cos(phi);
pos[i*3+1] = r*Math.sin(phi);
pos[i*3+2] = r*Math.sin(theta)*Math.cos(phi);
vel[i*3] = (Math.random()-0.5)*0.02 - Math.sin(theta)*0.1;
vel[i*3+1] = (Math.random()-0.5)*0.02;
vel[i*3+2] = (Math.random()-0.5)*0.02 + Math.cos(theta)*0.1;
}
geo.setAttribute('position',new THREE.BufferAttribute(pos,3));
const mat = new THREE.PointsMaterial({color:0x00ffff,size:0.12,transparent:true,opacity:0.9});
points = new THREE.Points(geo,mat);
scene.add(points);
}
rebuildSystem();
/* ---------- animation ---------- */
const v = new THREE.Vector3();
const diskNormal = new THREE.Vector3(0,1,0);
function animate(){
requestAnimationFrame(animate);
const p = geo.attributes.position.array;
const vArr = geo.attributes.velocity.array;
// dynamic disk tilt
diskNormal.set(0,1,0).applyAxisAngle(new THREE.Vector3(1,0,0),parseFloat(gui.tilt.value));
for(let i=0;i<N;i++){
const i3=i*3;
v.set(p[i3],p[i3+1],p[i3+2]);
// gravity
const r2 = v.lengthSq();
if(r2<0.01) continue;
const grav = v.clone().normalize().multiplyScalar(-parseFloat(gui.grav.value)/r2);
// swirl
const swirl = v.clone().cross(diskNormal).normalize().multiplyScalar(parseFloat(gui.swirl.value)*Math.sqrt(parseFloat(gui.grav.value)/r2));
// apply
vArr[i3] += grav.x + swirl.x;
vArr[i3+1] += grav.y + swirl.y;
vArr[i3+2] += grav.z + swirl.z;
// drag & speed cap
vArr[i3] *= parseFloat(gui.drag.value);
vArr[i3+1] *= parseFloat(gui.drag.value);
vArr[i3+2] *= parseFloat(gui.drag.value);
const speed = Math.sqrt(vArr[i3]**2 + vArr[i3+1]**2 + vArr[i3+2]**2);
const max = parseFloat(gui.speed.value);
if(speed>max){
vArr[i3] *= max/speed;
vArr[i3+1] *= max/speed;
vArr[i3+2] *= max/speed;
}
// update position
p[i3] += vArr[i3];
p[i3+1] += vArr[i3+1];
p[i3+2] += vArr[i3+2];
// wrap
['x','y','z'].forEach((_,j)=>{
if(Math.abs(p[i3+j])>25) p[i3+j]*=-1;
});
}
geo.attributes.position.needsUpdate=true;
renderer.render(scene,camera);
}
window.addEventListener('resize',()=>{
camera.aspect=innerWidth/innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(innerWidth,innerHeight);
});
animate();
</script>
</body>
</html>