I think you’d be interested in checking out a sketch that uses pixels[] for both Java Mode & p5js flavors: