Montag, 23. November 2026
<div id="mpkg-3d-wrapper" style="width: 100%; max-width: 750px; margin: 20px auto; border: 2px solid #333; border-radius: 8px; overflow: hidden; background: #1e2229; font-family: Arial, sans-serif; color: #fff;">
<div style="background: #2b303a; padding: 10px 15px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;">
<strong style="font-size: 16px;">MPKG – Interaktives 3D-Funktionsmodell</strong>
<div style="display: flex; gap: 8px; align-items: center;">
<button id="mpkg-toggle" style="padding: 6px 12px; background: #4caf50; color: white; border: none; border-radius: 4px; cursor: pointer; font-weight: bold;">Pause / Start</button>
<button id="mpkg-reset" style="padding: 6px 12px; background: #555; color: white; border: none; border-radius: 4px; cursor: pointer;">Ansicht zurücksetzen</button>
</div>
</div>
<div id="mpkg-canvas-container" style="width: 100%; height: 450px; cursor: grab;"></div>
<div style="background: #2b303a; padding: 10px 15px; font-size: 13px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px;">
<div>
<span style="display:inline-block; width:12px; height:12px; background:#d9534f; margin-right:4px;"></span> Hochdruck / Warm (Rot) |
<span style="display:inline-block; width:12px; height:12px; background:#3399ff; margin-right:4px;"></span> Niederdruck / Kalt (Blau) |
<span style="display:inline-block; width:12px; height:12px; background:#8bc34a; margin-right:4px;"></span> Rotortrommel & 4 Kolben
</div>
<div style="color: #bbb;">Tipp: Mit linker Maustaste drehen, Mausrad zoomen</div>
</div>
</div>
<script src="https://cloudflare.com"></script>
<script src="https://jsdelivr.net"></script>
<script>
(function() {
const container = document.getElementById('mpkg-canvas-container');
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x1e2229);
const camera = new THREE.PerspectiveCamera(45, container.clientWidth / container.clientHeight, 0.1, 1000);
camera.position.set(0, 0, 13);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(container.clientWidth, container.clientHeight);
container.appendChild(renderer.domElement);
const controls = new THREE.OrbitControls(camera, renderer.domElement);
controls.enableDamping = true;
// Licht
const ambientLight = new THREE.AmbientLight(0xffffff, 0.65);
scene.add(ambientLight);
const dirLight = new THREE.DirectionalLight(0xffffff, 0.8);
dirLight.position.set(10, 15, 15);
scene.add(dirLight);
// Materialien passend zu deinen Zeichnungen
const matStatorPink = new THREE.MeshPhongMaterial({ color: 0xf4a4c0, transparent: true, opacity: 0.9 });
const matDrumGreen = new THREE.MeshPhongMaterial({ color: 0x8bc34a, transparent: true, opacity: 0.55, side: THREE.DoubleSide });
const matPistonGrey = new THREE.MeshPhongMaterial({ color: 0xcccccc });
const matValve = new THREE.MeshPhongMaterial({ color: 0x555555 });
const matBlue = new THREE.MeshPhongMaterial({ color: 0x2196f3 });
const matRed = new THREE.MeshPhongMaterial({ color: 0xe53935 });
const matAxle = new THREE.MeshPhongMaterial({ color: 0x333333 });
// Hauptgruppe
const mpkgGroup = new THREE.Group();
scene.add(mpkgGroup);
// 1. STATOR (Feststehend innen)
const statorGroup = new THREE.Group();
mpkgGroup.add(statorGroup);
// Mittelachse & Innenring
const axle = new THREE.Mesh(new THREE.CylinderGeometry(1.1, 1.1, 3.6, 32), matAxle);
axle.rotation.x = Math.PI / 2;
statorGroup.add(axle);
const innerRing = new THREE.Mesh(new THREE.TorusGeometry(1.6, 0.25, 16, 48), matStatorPink);
statorGroup.add(innerRing);
// Äußerer Stator-Ring (Laufbahn)
const statorWall = new THREE.Mesh(new THREE.TorusGeometry(3.8, 0.22, 16, 64), matStatorPink);
statorGroup.add(statorWall);
// 8 Speichen / Zylinderkammern & 4 Ventile (90° versetzt)
const valves = [];
for (let i = 0; i < 8; i++) {
const angle = (i * Math.PI) / 4;
const spoke = new THREE.Mesh(new THREE.BoxGeometry(0.18, 2.1, 0.8), matStatorPink);
spoke.position.set(Math.cos(angle) * 2.7, Math.sin(angle) * 2.7, 0);
spoke.rotation.z = angle - Math.PI / 2;
statorGroup.add(spoke);
// Bei jedem 2. Segment (90° versetzt) ein Ventil & Druckkanäle (Rot/Blau)
if (i % 2 === 0) {
const unitGroup = new THREE.Group();
unitGroup.rotation.z = angle;
// Blauer Kanal (Niederdruck / Einlass)
const bluePipe = new THREE.Mesh(new THREE.BoxGeometry(1.8, 0.16, 0.4), matBlue);
bluePipe.position.set(2.6, 0.22, 0.25);
unitGroup.add(bluePipe);
// Roter Kanal (Hochdruck / Auslass)
const redPipe = new THREE.Mesh(new THREE.BoxGeometry(1.8, 0.16, 0.4), matRed);
redPipe.position.set(2.6, -0.22, 0.25);
unitGroup.add(redPipe);
// Bewegliches Ventil (Schieber)
const valveMesh = new THREE.Mesh(new THREE.BoxGeometry(0.45, 0.55, 0.65), matValve);
valveMesh.position.set(3.4, 0, 0);
unitGroup.add(valveMesh);
valves.push({ mesh: valveMesh, baseAngle: angle });
statorGroup.add(unitGroup);
}
}
// 2. ROTOR (Drehende Trommel außen mit 4 Kolben 90° versetzt)
const rotorGroup = new THREE.Group();
mpkgGroup.add(rotorGroup);
// Grüne Trommel (halbtransparent, damit man hineinsehen kann)
const drumGeo = new THREE.CylinderGeometry(4.45, 4.45, 2.6, 48, 1, true);
const drum = new THREE.Mesh(drumGeo, matDrumGreen);
drum.rotation.x = Math.PI / 2;
rotorGroup.add(drum);
// 4 Rotorkolben / Nocken (90° versetzt)
for (let i = 0; i < 4; i++) {
const angle = (i * Math.PI) / 2;
const piston = new THREE.Mesh(new THREE.BoxGeometry(0.55, 0.45, 1.8), matPistonGrey);
piston.position.set(Math.cos(angle) * 4.15, Math.sin(angle) * 4.15, 0);
piston.rotation.z = angle;
rotorGroup.add(piston);
}
// Animation
let isRunning = true;
let rotationAngle = 0;
document.getElementById('mpkg-toggle').addEventListener('click', () => {
isRunning = !isRunning;
});
document.getElementById('mpkg-reset').addEventListener('click', () => {
camera.position.set(0, 0, 13);
controls.target.set(0, 0, 0);
controls.update();
});
window.addEventListener('resize', () => {
if (!container) return;
camera.aspect = container.clientWidth / container.clientHeight;
camera.updateProjectionMatrix();
renderer.setSize(container.clientWidth, container.clientHeight);
});
function animate() {
requestAnimationFrame(animate);
if (isRunning) {
rotationAngle += 0.015;
rotorGroup.rotation.z = rotationAngle;
// Ventile bewegen sich synchron, wenn ein Rotorkolben vorbeikommt
valves.forEach(v => {
const relAngle = (rotationAngle - v.baseAngle) % (Math.PI / 2);
const pulse = Math.sin(relAngle * 4);
v.mesh.position.x = 3.4 - Math.max(0, pulse) * 0.35;
});
}
controls.update();
renderer.render(scene, camera);
}
animate();
})();
</script>

