Cada vez que ejecuto mi código, me da un error:
p5.js dice: Se produjo un error con el mensaje "pushMatrix() not used, see push()" dentro de la biblioteca p5js cuando se llamó a pushMatrix (en la línea 175 en sketch.js [/sketch.js:175:13])
Si no se indica lo contrario, podría ser un problema con los argumentos pasados a pushMatrix. ( http://p5js.org/reference/#/p5/pushMatrix )
Sin embargo, pushMatrix() no existe en mi código. Cuando trato de solucionarlo reemplazando push() con pushMatrix() , me da el mismo error:
p5.js dice: Se produjo un error con el mensaje "pushMatrix() not used, see push()" dentro de la biblioteca p5js cuando se llamó a pushMatrix (en la línea 175 en sketch.js [/sketch.js:175:13])
Si no se indica lo contrario, podría ser un problema con los argumentos pasados a pushMatrix. ( http://p5js.org/reference/#/p5/pushMatrix )
Mi código: https://pastebin.com/gMxwvJLA (StackOverflow no me dejaba publicar la pregunta porque el código era muy grande)
En resumen: pushMatrix() no es una función válida en p5 . no existe Desea buscar y reemplazar todos los usos de pushMatrix() con push() y popMatrix() con pop() .
Con esos reemplazos, su código se ejecuta sin errores y veo un cuadrado girando en el centro del lienzo.
El mensaje de error no es particularmente útil, pero mirar el código fuente aclara mucho las cosas.
/** * @for p5 * @requires core * These are functions that are part of the Processing API but are not part of * the p5.js API. In some cases they have a new name, in others, they are * removed completely. Not all unsupported Processing functions are listed here * but we try to include ones that a user coming from Processing might likely * call. */ import p5 from './main'; p5.prototype.pushStyle = function() { throw new Error('pushStyle() not used, see push()'); }; p5.prototype.popStyle = function() { throw new Error('popStyle() not used, see pop()'); }; p5.prototype.popMatrix = function() { throw new Error('popMatrix() not used, see pop()'); }; p5.prototype.pushMatrix = function() { throw new Error('pushMatrix() not used, see push()'); }; export default p5;