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

Rounded images #70

Closed
yuraantonov11 opened this issue Nov 11, 2019 · 6 comments · Fixed by #71
Closed

Rounded images #70

yuraantonov11 opened this issue Nov 11, 2019 · 6 comments · Fixed by #71

Comments

@yuraantonov11
Copy link

Hello, is there a simple way to render a rounded image(without using getCanvasTexture)?

@g-zachar
Copy link
Contributor

Hi @yuraantonov11
Yes, there is pretty strightforward way to do this using RadialFilter shader:

Base: {
  rtt: true,
  w: 100,
  h: 100,
  Inner: {
    shader: {
      type: lng.shaders.RadialFilter,
      radius: 50
    },
    src: "image",
  },
}

Example

Best regards

@yuraantonov11
Copy link
Author

Hi @g-zachar, thanks for your answer, I try to render some images(not only squares) with rounded corners. e.g.:
image
How can I set different radiuses?

@yuraantonov11
Copy link
Author

yuraantonov11 commented Nov 19, 2019

Can anyone answer my question?
@g-zachar?

@g-zachar
Copy link
Contributor

@yuraantonov11 I added shader for this specific purpose in 1.3.0, let me know if you have any further questions (you can check example here).

@yuraantonov11
Copy link
Author

@g-zachar, thanks for your answer, but I have one more question. Can I set rounding to different corners?

@g-zachar
Copy link
Contributor

@yuraantonov11 , it is not possible per se, but you can work around it by clipping parts of image that is being rounded (example)

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

Successfully merging a pull request may close this issue.

2 participants