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

235
Views
img.get() sometimes returns an image and sometimes an array in p5.js

Im trying to do sprite animation in p5.

let spritesheet;

function setup() {
    createCanvas(innerWidth, innerHeight);
    spritesheet = loadImage('./spritesheet.png')
    background(0)
}

function draw() {
    let img = spritesheet.get(0, 0, 100, 100)
    console.log(img)
    image(img,0,0,100,100)
}

When the y is 0

let img = spritesheet.get(0, 0, 100, 100)

It works fine but when I try to adjust values of z or y it breaks

let img = spritesheet.get(0, 100, 100, 100)

Here is the console log

console errror

about 4 years ago · Juan Pablo Isaza
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!