Closed codingMASTER398 closed 3 months ago
@codingMASTER398 I've tried to solve this issue by changing how tint
works in v2.1. Now tint
does not require temporary canvases to be made, it just uses native canvas API "multiply" blend mode compositing, and thus should be very fast for real time use.
tint
doesn't change the opacity of an image (like in p5), instead the tint's alpha value specifies how strong the tint should be. To dynamically change the opacity of anything drawn to the canvas, use opacity(globalAlpha).I think tint caching could be done by users if it's still deemed necessary. I'm going to close this out as completed.
Let me know what you think of the changes!
Looking over the code at school at the moment- tinted images seem to create their offscreen canvas, apply filters, then draw- every frame. If the tint stays the same, it makes sense to cache the canvas with the image, for quick drawing for subsequent frames. This would also help with changing tints, as they could simply change the pre-existing canvas without the need for overhead creating more canvases.