Jump to content

Very sharp images on mobile devices


Recommended Posts

const APP = new PIXI.Application({width: 1920, height: 1080, antialias: true, transparent: false, resolution: 1 });

// ... load page, then

APP.renderer.roundPixels = true;
APP.renderer.view.style.position = "absolute";
 APP.renderer.view.style.display = "block";
 APP.renderer.autoDensity = true;
 APP.renderer.resize(window.innerWidth, window.innerHeight);

//... load textures, then

let loaderSprite = new Sprite(RESOURCES.preloader.texture);

Hi all. On desktop after window resizing - all resources are smooth - it's good.  But in mobile, ios for example is VERY VERY crisp. What i can do wrong ? (resize methods below)

window.addEventListener("resize" , onResize);

function onResize()
    let ratio = Math.min(window.innerWidth / MAX_W, window.innerHeight / MAX_H);
    APP.stage.width = Math.floor(APP.stage.width);
    APP.stage.height = Math.floor(APP.stage.height);
    APP.stage.x = Math.floor(window.innerWidth / 2 - APP.stage.width / 2);
    APP.stage.y = Math.floor(window.innerHeight / 2 - APP.stage.height / 2);
    APP.renderer.resize(window.innerWidth, window.innerHeight);


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...