Jump to content

Using ScaleMode strings on Pixi v8?


cuca
 Share

Recommended Posts

On v8, the scale modes started being strings `'nearest'` and `'linear'`, as of migration guide. I'm not sure how/where do I set it, though. I've attempted to do `texture.scaleMode`, to add is as an object on Sprite constructor (since I didn't find any example anywhere of it).

How it is done now? Thanks in advance 😬

import { Application, Assets, Container, Sprite } from "pixi.js";

const app = new Application();

await app.init({
  background: "#1099bb",
  resizeTo: window,
});
document.body.appendChild(app.canvas);

const container = new Container();
app.stage.addChild(container);

const texture = await Assets.load("https://pixijs.com/assets/bunny.png");
const bunny = new Sprite(texture);
container.addChild(bunny);

 

Link to comment
Share on other sites

  • 1 month later...

You can set the scale mode it in baseTexture.

const texture = await Assets.load("https://pixijs.com/assets/bunny.png");
texture.source.scaleMode = 'nearest';
const bunny = new Sprite(texture);
bunny.scale = 10;
Edited by emptygamer
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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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