Zobrazit stránkuStarší verzeZpětné odkazyNahoru Tato stránka je pouze pro čtení. Můžete si pouze prohlédnout zdrojový kód, ale ne ho měnit. Zeptejte se správce, pokud si myslíte, že něco není v pořádku. <code javascript> x = 100 y = 100 otoceni = 0 delka = 1 for(var i=0;i<50;i++){ if(otoceni==0){x+=delka} //TODO: dopln ostatni smery otoceni=(otoceni+1)%4 delka++ console.log(x,y) } </code> <code html> <!DOCTYPE html> <html lang="cs"> <head> <meta charset="utf-8" /> <title>Titulek</title> <style> .platno { position: relative; } .bod { position: absolute; background-color:black; width:2px; height:2px; } </style> </head> <body> <div class='platno' id="platno"></div> <script> x = 100 y = 100 otoceni = 0 delka = 1 for(var i=0;i<50;i++){ if(otoceni==0){x+=delka} //TODO: dopln ostatni smery otoceni=(otoceni+1)%4 delka++ var bod = document.createElement("div") bod.className = "bod" document.getElementById("platno").appendChild(bod); bod.style.left=x+"px" bod.style.top=y+"px" console.log(x,y) } </script> </body> </html> </code> krouzek/generovani_spiraly.txt Poslední úprava: 2023/11/15 20:54autor: 127.0.0.1