jonobr1 / two.js

A renderer agnostic two-dimensional drawing api for the web.
https://two.js.org
MIT License
8.29k stars 454 forks source link

[Question] Resizing image loaded into sprite #666

Closed Lucasvo1 closed 1 year ago

Lucasvo1 commented 1 year ago

How can I resize an image loaded into a sprite? Now I use the following:

var sprite = two.makeSprite('./cala-text.jpg', two.width/2, two.height/2); The actual dimensions of the picture are 15000x150000. When I resize them on the server before it works. Is it possible to do it client-side?

jonobr1 commented 1 year ago

Sorry for the delay, I'm on vacation right now. Short answer is yes, I'll put together an example to show how this works.

jonobr1 commented 1 year ago

Here's the simplest way to scale images that are loaded in as Two.Sprites: https://codepen.io/jonobr1/pen/ZEowwQR