What is better load image 18.7 KB or make it manually with p5.js functions like 'ellipse,rect...etc'

I can load image or make it manually with p5 functionality, so what is better for performance ? This is my code with manually created image :

https://alpha.editor.p5js.org/Worseize/sketches/r1DP9KrtG

Answers

  • edited March 2018 Answer ✓

    Never actually tested such case. But my bet goes to 1 image over drawings. :-??

    In case you've got drawings only, but want the supposed benefit of an image, you can createGraphics(), draw your stuff there.

    Once your drawings are finished there, optionally if you prefer, you can invoke its method get() in order to clone it as a p5.Image.

    Either way, you can now use image() in order to display your drawings over & over. :-bd

    And w/ some luck, it's gonna pay off, and you'll get a better performance. \m/

Sign In or Register to comment.