Demos (Gruppe D): Image cb-web, Aufgaben d-10 Snake, d-11 Sonnensystem, d-12 Highscore auf eigener Lösung, Browser-Prüfung mit Screenshot und Checkliste, Aufgaben mit depends_on

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-09 13:53:14 +01:00
parent c8a24fd8b3
commit 8e5be1ed0b
34 changed files with 1125 additions and 30 deletions

View File

@ -0,0 +1,25 @@
<!doctype html>
<html lang="de"><head><meta charset="utf-8"><title>Sonnensystem</title>
<style>
html,body{margin:0;height:100%;overflow:hidden;background:#05060f;color:#ddd;font-family:sans-serif}
#space{position:relative;width:1280px;height:760px}
#sun{position:absolute;left:655px;top:405px;width:50px;height:50px;margin:-25px 0 0 -25px;border-radius:50%;background:#fc3;box-shadow:0 0 40px #fa0}
.planet{position:absolute;border-radius:50%;cursor:pointer;margin:-8px 0 0 -8px;width:16px;height:16px}
#info{position:absolute;left:10px;top:10px;width:300px}
#pause{position:absolute;right:10px;top:10px}
</style></head><body>
<div id="space"><div id="sun"></div><div id="info">Klicke auf einen Planeten</div><button id="pause">Pause</button></div>
<script>
const data=[["merkur","Merkur",50,"#aaa",4,"4879 km"],["venus","Venus",80,"#e9c",3.2,"12104 km"],["erde","Erde",115,"#4af",2.6,"12742 km"],["mars","Mars",150,"#e64",2.1,"6779 km"],["jupiter","Jupiter",200,"#d96",1.4,"139820 km"],["saturn","Saturn",250,"#eb8",1.1,"116460 km"],["uranus","Uranus",295,"#8dd",0.8,"50724 km"],["neptun","Neptun",335,"#46f",0.6,"49244 km"]];
const space=document.getElementById("space"),info=document.getElementById("info");
let paused=false;const els=[];
for(const [id,name,r,col,sp,dia] of data){
const o=document.createElement("div");o.style.cssText=`position:absolute;left:655px;top:405px;width:${2*r}px;height:${2*r}px;margin:${-r}px 0 0 ${-r}px;border:1px solid #223;border-radius:50%`;space.appendChild(o);
const p=document.createElement("div");p.className="planet";p.dataset.planet=id;p.style.background=col;
p.onclick=()=>{info.textContent=`${name}: Durchmesser ${dia}, Abstand ${r} Einheiten`};space.appendChild(p);els.push([p,r,sp,Math.random()*6]);
}
let last=performance.now();
function tick(t){const dt=(t-last)/1000;last=t;for(const e of els){if(!paused)e[3]+=dt*e[2]*0.6;e[0].style.left=(655+e[1]*Math.cos(e[3]))+"px";e[0].style.top=(405+e[1]*Math.sin(e[3]))+"px"}requestAnimationFrame(tick)}
requestAnimationFrame(tick);
document.getElementById("pause").onclick=()=>{paused=!paused};
</script></body></html>