stararawn / woodpecker_ui Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
Was trying to get woodpecker to work with a 2d camera for the ui and a 3d camera for the game, so tried using RenderLayers and:
It looks like bevy_vello doesn't currently support RenderLayers: linebender/bevy_vello#58
it has a PR open for multi-camera support though, which seems blocked only by merge conflicts: linebender/bevy_vello#49
maybe related to/mergable with #13
Currently scrolling is a bit laggy when you have lots of widgets. This is because child widgets get re-rendered when you scroll(scroll widgets change). I can think of two possible solutions to fix this:
Pros:
Pros:
I've extracted a custom TransitionTimer and Button widget to a repo for reproduction: https://github.com/ChristopherBiscardi/woodpecker_buttons_repro
By default in the repo, because there is a mutation of WoodpeckerStyle
from the main_menu_interaction system, the Transitions re-occur constantly, seemingly due to re-initializing the values which in turn causes the timers to run, etc.
commenting that single line out shows a different behavior, that only re-starts the Transition when the window resizes.
From an implementation point of view, this style update is unrelated to the Transition behavior and should not cause the TransitionTimer to re-start.
I want to animated two solid color bars across the area the button will show in, spawning in the button behind these bars during the animation similar to a "stinger" transition. Once the Transition is over, I never want it to happen again.
Additionally, I want to have hover states affect the styles on the button after the Transition is over. Implementing these hover states is where I started to run into issues (specifically, the style mutation).
The goal of the button is to play two solid color bars across the button surface area the first time it renders, revealing the content underneath. It currently achieves this through a custom TransitionTimer
component that accepts a vec of styles and a vec of timers. Each element in the widget is then animated multiple times using these timers, lerp, and a mutation of the WoodpeckerStyle
(basically the same logic as the current built-in Transition
).
In a future implementation, I'd like this "Stinger" entrance behavior to be its own encapsulated behavior that I can add to a variety of widgets. I'm probably also going to try to take advantage of clipping so that the reveal is all left-to-right whereas currently it is first block left->right, second block left->right, second block right->left.
In React (and some other UI frameworks), the render
function re-runs any time there are props or state updates. This is not the case when the WoodpeckerStyle
component is updated, so there is clearly a "second render function" to think about (ie: vello) from that perspective. What is the mental model for the Widget::render
function given these additional rendering updates, and in conjunction with the new hooks/state functionality?
I think answers to that then follow on with "should TransitionTimer and PickingInteraction drive widget state" and "how do arbitrary Component values on the entity relate to props/state/etc and when should each be used".
Vello should provide this out of the box we just need to hook it up
bevy_vello
supports these we can too!
This just pertains to clearing out the bundle by calling WidgetChildren::clear()
.
Todo examples really show a full fleshed out UI and help squash bugs. Lets make one!
(Requires #9)
Widget context should exist local to the tree where it is spawned. API example:
// parent.rs
let context_entity = api.use_context::<T>(current_widget);
commands.entity(context_entity).spawn(MyContext);
// child.rs
let context_entity = api.use_context::<T>(current_widget);
let Ok(context) = context_query.get(context_entity) else {
return;
}
Sometimes scrolling can flicker when you scroll, I think this is caused by a weird issue where the layout tree sets a height to be the size of the scrollable content but then rights itself the next frame causing a flicker.
Taffy API is kinda gross. Also the taffy types conflict with bevy types. Ideally we just have our own style types and convert to taffy types as needed. This also lets us extend and add rendering types like: background color, font size, font color, etc.
Just need to figure out how to grok the types into playing nicely.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.