This commit is contained in:
2025-02-13 18:50:22 +01:00
parent 5c211013b5
commit 4cae4e9e28
803 changed files with 107055 additions and 14 deletions

View File

@@ -0,0 +1,56 @@
const bilder = [
{
dateiname: "robot.png",
beschreibung: "Frida Kahlo painting of a robot waving goodbye",
},
{
dateiname: "meadow.png",
beschreibung:
"A photo of a wide green meadow and a clear blue sky",
},
{
dateiname: "elephant.png",
beschreibung: "A pink elephant in a small room",
},
{
dateiname: "fhdortmund.png",
beschreibung: "An expressive oil painting of FH Dortmund in summer",
},
];
// Hier den Code ergaenzen!
module.exports = {
holeStartBild: function () {
return {
bild: bilder[0],
index: 0,
};
},
vor: function (aktuellerIndex) {
const neuerIndex = (aktuellerIndex + 1) % bilder.length;
return {
bild: bilder[neuerIndex],
index: neuerIndex,
};
},
zurueck: function (aktuellerIndex) {
let neuerIndex = aktuellerIndex - 1;
if (neuerIndex < 0) {
neuerIndex = bilder.length - 1;
}
return {
bild: bilder[neuerIndex],
index: neuerIndex,
};
},
holeBildMitIndex: function (index) {
const validIndex = Math.max(0, Math.min(index, bilder.length - 1));
return {
bild: bilder[validIndex],
index: validIndex,
};
},
};