Anonymous
Pixi JS - Повторяющая текстура для удара
Сообщение
Anonymous » 06 июн 2025, 11:22
Привет, мне трудно узнать, как установить текстуру, чтобы повторить ее динамически. Есть ли даже способ сделать это?
Код: Выделить всё
const g = new PIXI.Graphics();
const path = new PIXI.GraphicsPath();
path.moveTo(100, 100);
path.lineTo(200, 100);
path.arcTo(250, 100, 250, 150, 30); // Rounded corner
path.lineTo(250, 200);
// Load texture
const baseTexture = await PIXI.Assets.load('https://pixijs.io/examples/examples/assets/bunny.png');
// ✅ Set wrap mode to REPEAT on baseTexture
baseTexture.wrapMode = PIXI.WRAP_MODES.REPEAT;
baseTexture.update(); // apply changes to GPU
// Create Texture from baseTexture (you can also reuse baseTexture directly)
const texture = new PIXI.Texture(baseTexture);
// Use the path and stroke with the texture
g.path(path);
g.stroke({ width: 12, texture: texture }); // adjust width for visibility
app.stage.addChild(g);
попросите кого -нибудь встретиться и обрабатывать, как к этому?
Подробнее здесь:
https://stackoverflow.com/questions/796 ... for-stroke
1749198172
Anonymous
Привет, мне трудно узнать, как установить текстуру, чтобы повторить ее динамически. Есть ли даже способ сделать это?[code]const g = new PIXI.Graphics(); const path = new PIXI.GraphicsPath(); path.moveTo(100, 100); path.lineTo(200, 100); path.arcTo(250, 100, 250, 150, 30); // Rounded corner path.lineTo(250, 200); // Load texture const baseTexture = await PIXI.Assets.load('https://pixijs.io/examples/examples/assets/bunny.png'); // ✅ Set wrap mode to REPEAT on baseTexture baseTexture.wrapMode = PIXI.WRAP_MODES.REPEAT; baseTexture.update(); // apply changes to GPU // Create Texture from baseTexture (you can also reuse baseTexture directly) const texture = new PIXI.Texture(baseTexture); // Use the path and stroke with the texture g.path(path); g.stroke({ width: 12, texture: texture }); // adjust width for visibility app.stage.addChild(g); [/code] попросите кого -нибудь встретиться и обрабатывать, как к этому? Подробнее здесь: [url]https://stackoverflow.com/questions/79655598/pixi-js-repeating-texture-for-stroke[/url]