Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

293
Visualizações
Uncaught TypeError: Cannot read properties of undefined (reading 'frame')

I'm currently trying to animate a few frames from a spritesheet using Phaser3. The page successfully renders the first frame of the animation to the screen, but fails when I try to actually code in any of the animations.

Here's what I have so far:

export default class Intro_Animation extends Phaser.Scene
{
  constructor()
  {
    super('Intro_Animation');
  }

  intro(){}

  preload()
  {
    this.load.path = './src/assets/intro/';

    this.load.spritesheet('intro_frame', 'westwardJourney_02-Sheet.png',
  {frameWidth: 144, frameHeight: 130});
  }

  create()
  {
    //fails somewhere in the animations here
    var introAnim_config = {
        key: 'introWalkAnim',
        frames: this.anims.generateFrameNumbers('intro_walk', { start: 0, end: 23, first: 23 }),
        frameRate: 20,
        repeat: -1
    };

    this.anims.create(introAnim_config);

    //loads in first frame here
    this.add.sprite(250, 150, 'intro_frame').play('introWalkAnim');
  }
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I just can assume, without knowing the exact error message, that the frameWidth and/or frameHeight is maybe too big (meaning: bigger than the actual image size, even for 1px is enough). This could produce an error like:

Uncaught TypeError: Cannot read properties of undefined (reading 'duration') ...

and also show an image.

Except this, I don't know any other reason, how an error could occur, while displaying atleast a part of an image, and I tested serveral possibilities and combinations.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda