neu
This commit is contained in:
parent
a19539ae57
commit
5cb687f97b
@ -19,6 +19,10 @@ body{
|
||||
#tom{
|
||||
position: fixed;
|
||||
}
|
||||
#fuchs {
|
||||
position: fixed;
|
||||
bottom: 1px;
|
||||
}
|
||||
#fuchs img{
|
||||
width: 200px;
|
||||
position: relative;
|
||||
@ -36,10 +40,10 @@ body{
|
||||
flex-direction: row;
|
||||
}
|
||||
#rechnungen{
|
||||
padding: 25px;
|
||||
padding: 0px;
|
||||
justify-content: space-between;
|
||||
position: relative;
|
||||
top: 100px;
|
||||
top: 1px;
|
||||
}
|
||||
#rechnung1, #rechnung2 {
|
||||
width: 20%;
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
|
||||
</div>
|
||||
<Script src="js/Kevin.js"></Script>
|
||||
<Script src="js/funktionen.js"></Script>
|
||||
<Script src="js/allg.js"></Script>
|
||||
|
||||
|
30
js/Kevin.js
30
js/Kevin.js
@ -0,0 +1,30 @@
|
||||
const rechnungen = document.querySelector("#rechnungen");
|
||||
let rechnungenTop = 1;
|
||||
|
||||
const rechenzeichen = ['+','-','*',':'];
|
||||
const rechnung1Text = document.querySelector("#rechnung1");
|
||||
const rechnung2Text = document.querySelector("#rechnung2");
|
||||
|
||||
rechnungen.style.top = rechnungenTop + "px";
|
||||
function rechnungMoven(speed){
|
||||
let nextTop = rechnungenTop + 10 * speed;
|
||||
rechnungen.style.top = nextTop + "px";
|
||||
if(nextTop > 800){
|
||||
rechnungen.style.top = "1px";
|
||||
rechnungenTop = 1;
|
||||
rechnungenSpawn();
|
||||
}else{
|
||||
rechnungenTop = nextTop;
|
||||
}
|
||||
}
|
||||
function rechnungenSpawn(){
|
||||
let index = Math.random()*rechenzeichen.length;
|
||||
let randomZahl = Math.random()*20;
|
||||
rechnung1Text.innerText = rechenzeichen[index] + randomZahl;
|
||||
index = Math.random()*rechenzeichen.length;
|
||||
randomZahl = Math.random()*20;
|
||||
rechnung2Text.innerText = rechenzeichen[index] + randomZahl;
|
||||
}
|
||||
setInterval(()=>{
|
||||
rechnungMoven(1);
|
||||
}, 100);
|
@ -16,7 +16,7 @@ function addToScore(currentScore,zahl,rechenOperator){
|
||||
if(rechenOperator == "Mal"){
|
||||
ergebnis = currentScore * zahl;
|
||||
}
|
||||
if(rechenOperator == "geteilt"){
|
||||
if(rechenOperator == "Geteilt"){
|
||||
ergebnis = currentScore / zahl;
|
||||
}
|
||||
return ergebnis;
|
||||
|
Loading…
Reference in New Issue
Block a user