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

Extend gradient decorator to work similarly to -webkit-gradient #249

Closed
MatthiasJFM opened this issue Nov 1, 2021 · 3 comments · Fixed by #594
Closed

Extend gradient decorator to work similarly to -webkit-gradient #249

MatthiasJFM opened this issue Nov 1, 2021 · 3 comments · Fixed by #594
Labels
enhancement New feature or request
Milestone

Comments

@MatthiasJFM
Copy link

I'm looking to fade-out content on an element with a partially transparent background, but this feature would be useful for any background that is not a solid colour or has complex patterns.
The current gradient decorator is used for background gradients, I'm looking for a mask-gradient on the content (in my case for opacity) which can set on a particular area of the element.

For a use case, picture a scrolling area with a partially transparent background with a narrow region at the top and bottom where content can fade out into transparency.

Would be interested to know if it's doable!

@mikke89 mikke89 added the enhancement New feature or request label Nov 1, 2021
@mikke89
Copy link
Owner

mikke89 commented Nov 1, 2021

Thanks for the suggestion. So this would probably fit perfectly with the filter feature we have been discussing a bit on the chat. In essence this would be like an enhanced decorator, where render commands such as render begin and all children rendered are sent through the render API. Then the user could act on these commands. For example in your case you could make all children render to an off-screen texture, and then at the end render that texture with fading applied using a custom shader.

Of course, this would still require some customization on the client side. If we wanted to to make it more ergonomic we could possibly think about making some new render API for render-to-texture support and somehow custom shaders.

You could already do this with some creativity. Eg. making the container element use a special texture source name that the render API acts upon, and a "dummy" element as the last child to say that all children have been rendered.

@mikke89 mikke89 added this to the 5.0 milestone Apr 2, 2022
@mikke89
Copy link
Owner

mikke89 commented Apr 2, 2022

The mask-image property is now being worked on for RmlUi 5.0. This will also support gradients and all other decorators being used as alpha masks. Here is a basic example (currently being worked on in the filter branch):

image

The second box uses a gradient and an image decorator to alpha mask the contents of the element.

@mikke89
Copy link
Owner

mikke89 commented Apr 2, 2022

For trivia sake, this feature was asked for all the way back in #1 :)

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

Successfully merging a pull request may close this issue.

2 participants