Website erstellen - Mit Lua/Luau möglich?

Ist es eigentlich möglich, mit Lua oder Luau eine qualitative Website mit komplexem Layout und 3D-Elementen zu erstellen, oder kommt man um den JavaScript nicht herum?

Ich bin Anfänger (habe noch mich noch nie mit programmieren/coden vertraut gemacht) und möchte damit beginnen, zu lernen, wie man einen Code zu einer Website transformiert, habe mich damit aber noch nicht auseinandergesetzt (ich habe bisher noch keine Erfahrung mit coden von Websites). Und ja, bisher habe ich keine einzelne Zeile Code geschrieben und kenne mich auch nicht wirklich aus. Jedenfalls, für mich wäre es effizienter und eventuell auch besser, mich mit Lua vertraut zu machen, aber da ich dazu nichts gefunden habe, habe ich die Befürchtung, dass JavaScript nicht zu umgeben ist. Und so bin ich auf gutefrage.net gekommen, wie jeder, wenn er etwas sucht.

Kurzgefasst interessiert mich, ob man mit Lua folgendes tun kann:

  • Eine Website mit 3D-Effekten erstellen
  • Eine Website mit Animationen erstellen
  • Komplexe Layouts Wirklichkeit werden lassen

Ich bin noch ein richtiger Anfänger, aber mich würden eure Antwort und euer Wissen interessieren, damit ich weiß, was für die Zukunft besser ist (schließlich möchte ich eine Programmiersprache für die Erstellung von Websites lernen und dieses Wissen auch festigen, nicht umher springen von Programmiersprache zu Programmiersprache), denn es ist ja klar, dass ich erst klein beginnen würde (keine komplexen Layouts, Animationen, ...).

Danke!

Homepage, App, HTML, Webseite, CSS, JavaScript, HTML5, lua, Programmiersprache, Webdesign, Webentwicklung
JS Taschenrechner, Dezimal in Binär und andersherum auch?

Hallo Zusammen,
ich bin seit knapp 3 Wochen in meiner Ausbildung und sollte einen Taschenrechner programmieren, was bis jetzt auch geklappt hat. Nun habe ich eine neue Aufgabe dazu bekommen, nämlich mit 2 Radio Buttons mir jeweils anzeigen zu lassen: Binär und Dezimal.
Ich bin absolut hilflos und freue mich über mögliche Lösungen und HIlfe. Danke im voraus.

<!DOCTYPE html>
<html lang="de">
   <head>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Taschenrechner No. 3</title>
      <script>
         let aktuellesErgebnis = 0;
         let modus;
         let aktuelleZahl;
         function AddLetter(zahl)
         {
         if(modus == null) 
         {
         document.getElementById("textboxDisplay").value = zahl;
         modus = "Nummern";
         }
         else
         {
         document.getElementById("textboxDisplay").value += zahl;
         }
         }
         function Plus()
         {
         Hilfe();
         document.getElementById("textboxDisplay").value = "";
         modus = "Plus";
         }
         function Minus()
         {
         Hilfe();
         document.getElementById("textboxDisplay").value = "";
         modus = "Minus";
         }
         function Mal()
         {
         Hilfe();
         document.getElementById("textboxDisplay").value = "";
         modus = "Mal"
         }
         function Geteilt()
         {
         Hilfe();
         document.getElementById("textboxDisplay").value = "";
         modus = "Geteilt"
         }
         function Restwert()
         {
         Hilfe();
         document.getElementById("textboxDisplay").value = "";
         modus = "Modulo"
         }
         function Gleich()
         {
         Hilfe();
         document.getElementById("textboxDisplay").value = aktuellesErgebnis;
         modus = null;
         }
         function Hilfe()
         {
         aktuelleZahl = Number(document.getElementById("textboxDisplay").value);
         if(modus == "Plus")
         {
         aktuellesErgebnis += aktuelleZahl;
         }
         if(modus == "Minus")
         {
         aktuellesErgebnis -= aktuelleZahl;
         }
         if(modus == "Mal")
         {
         aktuellesErgebnis *= aktuelleZahl;
         }
         if(modus == "Geteilt")
         {
         aktuellesErgebnis /= aktuelleZahl;
         }
         if(modus == "Modulo")
         {
         aktuellesErgebnis %= aktuelleZahl;
         }
         if(modus == null || modus == "Nummern")
         {
         aktuellesErgebnis = aktuelleZahl;
         }
         }
         function Weg()
         {
         document.getElementById("textboxDisplay").value = "";
         aktuellesErgebnis = 0;
         modus = null;
         }
      </script>
   </head>
   <body>
      <input type="radio" name="Umrechnung" value="Binär" />
      <input type="radio" name="Umrechnung" value="Dezimal" />
      <input id="textboxDisplay" readonly />
      <input type="button" value="1" onclick="AddLetter('1')" />
      <input type="button" value="2" onclick="AddLetter('2')" />
      <input type="button" value="3" onclick="AddLetter('3')" />
      <input type="button" value="4" onclick="AddLetter('4')" />
      <input type="button" value="5" onclick="AddLetter('5')" />
      <input type="button" value="6" onclick="AddLetter('6')" />
      <input type="button" value="7" onclick="AddLetter('7')" />
      <input type="button" value="8" onclick="AddLetter('8')" />
      <input type="button" value="9" onclick="AddLetter('9')" />
      <input type="button" value="0" onclick="AddLetter('0')" />
      <input type="button" value="+" onclick="Plus()" />
      <input type="button" value="-" onclick="Minus()" />
      <input type="button" value="*" onclick="Mal()" />
      <input type="button" value="/" onclick="Geteilt()" />
      <input type="button" value="Mod" onclick="Restwert()" />
      <input type="button" value="Löschen" onclick="Weg()" />
      <input type="button" value="=" onclick="Gleich()" />
   </body>
</html>
HTML, Webseite, JavaScript, Code, Programmiersprache
WebGL - Clip Space | Pixel Space?
// Renderer Beispiel
 render(){
       const s2  = new Square(300, 100, 70, [0, 1, 1, 1]);
       s2.setup(this.context, this.program); 
       s2.render(this.program, this.context, deltaTime);

       this.vertexManager.draw(3, 0, 4, 100, 100, 0, [0,0,1,1]);
 }
// 

export class Square extends Renderable {
    constructor (x, y, size, color) {
        super();
        this.x = x;
        this.y = y;
        this.size = size;
        this.color = color;
        this.vertices = new Float32Array([
            -size / 2, -size / 2,
            size / 2, -size / 2,
            size / 2, size / 2,
            -size / 2, size / 2,
        ]);
        this.vertexBuffer = null;
        this.colorBuffer = null;
        this.transformationMatrix = createIdentityMatrix3();
    }

    setup (gl, program) {
        this.vertexBuffer = gl.createBuffer();
        gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer);
        gl.bufferData(gl.ARRAY_BUFFER, this.vertices,  gl.STATIC_DRAW);
    }

    updateTransformationMatrix (x, y, scaleX, scaleY, angle) {
        const translationMatrix = createTranslationMatrix(x, y);
        const rotationMatrix = createRotationMatrix(angle);
        const scalingMatrix = createScalingMatrix(scaleX, scaleY);

        // Combine the matrices: translation * rotation * scaling
        const combinedMatrix = multiplyMatrices(rotationMatrix,          multiplyMatrices(translationMatrix, scalingMatrix));

        // Save the transformation matrix
        this.transformationMatrix = combinedMatrix;
    }


    render (program, gl, camera, deltaTime) {
        gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer);

        // Re-enable the vertex attribute array
        const positionLocation = gl.getAttribLocation(program, 'a_position');
        gl.enableVertexAttribArray(positionLocation);
        gl.vertexAttribPointer(positionLocation, 2, gl.FLOAT, false, 0, 0);

        const colorLocation = gl.getUniformLocation(program, 'u_color');
        gl.uniform4fv(colorLocation, this.color);

        const matrixLocation = gl.getUniformLocation(program, 'u_matrix');
        this.updateTransformationMatrix(this.x, this.y, 1.0, 1.0,  0);
        gl.uniformMatrix3fv(matrixLocation, false, this.transformationMatrix);

        gl.drawArrays(gl.TRIANGLE_FAN, 0, this.vertices.length / 2 + 1);
    }
}

export default class VertexManager {
    constructor (gl, program) {
        this.gl = gl;
        this.program = program;
        this.buffers = new Map();
        this.initBuffers();
    }

    initBuffers () {
        this.createBuffer(BUFFER_TYPES.CIRCLE, createPolygonVertices(64, 1));
        this.createBuffer(BUFFER_TYPES.SQUARE, new Float32Array([
            -0.5, -0.5,
            0.5, -0.5,
            0.5, 0.5,
            -0.5, 0.5,
        ]));
    ....
    }

    createBuffer (type, vertices) {
        const buffer = this.gl.createBuffer();
        this.gl.bindBuffer(this.gl.ARRAY_BUFFER, buffer);
        this.gl.bufferData(this.gl.ARRAY_BUFFER, vertices, this.gl.STATIC_DRAW);
        this.buffers.set(type, { buffer, vertexCount: vertices.length / 2 });
    }

    draw (type, x, y, scaleX, scaleY, rotation, color) {
        const { buffer, vertexCount } = this.buffers.get(type);

        this.gl.bindBuffer(this.gl.ARRAY_BUFFER, buffer);

        // Re-enable the vertex attribute array
        const positionLocation = this.gl.getAttribLocation(this.program, 'a_position');
        this.gl.enableVertexAttribArray(positionLocation);
        this.gl.vertexAttribPointer(positionLocation, 2, this.gl.FLOAT, false, 0, 0);

        // Setup the color
        const colorLocation = this.gl.getUniformLocation(this.program, 'u_color');
        this.gl.uniform4fv(colorLocation, color);

        const matrixLocation = this.gl.getUniformLocation(this.program, 'u_matrix');
        // Create transformation matrices directly in pixel space
        const translationMatrix = createTranslationMatrix(x, y);
        const rotationMatrix = createRotationMatrix(rotation);
        const scalingMatrix = createScalingMatrix(scaleX, scaleY);

        // Combine them: translationMatrix * rotationMatrix * scalingMatrix
        const combinedMatrix = multiplyMatrices(rotationMatrix, multiplyMatrices(translationMatrix, scalingMatrix));

        // Pass the transformation matrix to the shader
        this.gl.uniformMatrix3fv(matrixLocation, false, combinedMatrix);

        this.gl.drawArrays(this.gl.TRIANGLE_FAN, 0, vertexCount);
    }
}

Meine Frage ist, warum mein Quadrat korrekt im Pixel-Space gerendert wird, während die draw-Operation in meinem VertexManager Clip-Space zeichnet, obwohl beide denselben Shader verwenden. Ich habe das Problem schon seit Stunden versucht zu lösen. Hat jemand eine Lösung oder einen Hinweis, was ich möglicherweise falsch mache?

Bild zum Beitrag
JavaScript, Code, OpenGL, Webentwicklung

Meistgelesene Beiträge zum Thema JavaScript