Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add a background image to a rectangle? #653

Open
xielonghua opened this issue Aug 11, 2022 · 1 comment
Open

How to add a background image to a rectangle? #653

xielonghua opened this issue Aug 11, 2022 · 1 comment

Comments

@xielonghua
Copy link

I want to add a background image to Two.Rectangle. The size of the background image can be increased to the same size as Two.Rectangle.

@jonobr1
Copy link
Owner

jonobr1 commented Aug 11, 2022

There's actually not a great way to do that at the moment. This is because the texture formation is inspired with spritesheet animations in mind. To do what you're asking is a different methodology. I tried to reconcile the two, but it's going to take some time.

Likely, it will be easier to set some configurations on Two.Texture whereby the defaults will be what you're asking and Two.Sprite and Two.ImageSequence will implement additional configurations on the under the hood to keep consistency.

You can see my working branch here: https://github.com/jonobr1/two.js/tree/issue-653-texture-sizing

Not a great answer, but in the meantime I recommend making your image content the actual size you want to use it in. Or, you can use it like this: https://codepen.io/jonobr1/pen/rNdZNwM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants