INNER CODE UNIT · JavaScript

aspectRatio

electronicarts/pbmpm · src/main.js:487

    const aspectRatio = resolution[0] / resolution[1];
    ui.setRequiredAspectRatio(aspectRatio);
    ui.windowResize();

    const currentResolution = [ui.g_canvas.width, ui.g_canvas.height];

    const widthScale = currentResolution[0]/resolution[0];
    const heightScale = currentResolution[1]/resolution[1];

    // Geometric mean
    const scaleScale = Math.sqrt(widthScale*heightScale);

    var shapes = json.shapes;
    ui.clearShapes();

    for(var shape of shapes)
    {
        shape.position.x *= widthScale;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…