Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

186
Views
Cómo dividir imágenes en diferentes sprites de un archivo png en pixi.js

Tengo un png que contiene un par de cosas, como un perro, un gato, un ratón, un dophine.

Uso pixi js para renderizar este archivo png como un sprite, pixi renderiza todos estos animales en una fila como dibujados en png.

¿Hay alguna forma de cortarlos en diferentes sprites después de cargar este único png en pixi js? Para poder manipularlos por separado.

¡Gracias!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Responda mi propia pregunta como complemento de detalles a la respuesta de @ domis86.

Exactamente como decía su enlace referido:

Importe el archivo png que contiene múltiples gráficos de interés, defina un objeto rectangular que se usa para capturar el sprite individual. Cárgalo. Hazlo repetidamente para capturar todo el sprite.

 const texture = TextureCache["images/tileset.png"]; // this image has a couple of animals const catRectangle = new Rectangle(0, 0, 64, 64); const dogRectangle = new Rectangle(64, 0, 64, 64); const lionRectangle = new Rectangle(128, 0, 64, 64); texture.frame = catRectangle const cat = new Sprite(texture); texture.frame = dogtRectangle const dog = new Sprite(texture); texture.frame = LionRectangle const Lion = new Sprite(texture);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!