emilk / emilk/egui

Allow setting a default easing function in `Style`

Open
#5,463 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
30.6k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
72

Description

**Is your feature request related to a problem? Please describe.**

Developer may prefer using certain easing function because of branding, coherence with easing used by rest of the system or personal preference. But now, the built-in animations such as [`SidePanel::show_animated`](https://docs.rs/egui/latest/egui/containers/panel/struct.SidePanel.html#method.show_animated) or [`CollapsingHeader`](https://docs.rs/egui/latest/egui/containers/collapsing_header/struct.CollapsingHeader.html) use the default, non-customizable easing.

**Describe the solution you'd like**

I would add new field to [`Style`](https://docs.rs/egui/latest/egui/style/struct.Style.html), something like `easing` being a struct containing three easing functions: `ease_out`, `ease_in` and `ease_in_out`. The built-in widgets would use these easing functions by default (eg. [`animate_bool_responsive`](https://docs.rs/egui/latest/egui/struct.Context.html#method.animate_bool_responsive) would use `ease_out`).

Additionally, widgets built by the community could also use these default easings, making animations customizable while keeping them consistent.

**Describe alternatives you've considered**

- Allowing to specify easing functions on the built-in widgets individually
- Letting user specify only the `ease_out` function in the style, because AFAIK ease-in isn't used anywhere in egui right now. This would also eliminate the need for something like an `Easings` struct.

Contributor guide

Open the contributing guide

Research direction

Start by tracing Style and the named animation entry points: SidePanel::show_animated, CollapsingHeader, and Context::animate_bool_responsive. Determine how built-in easing is selected and how community widgets could access style defaults. Done means a Style-level easing configuration is used consistently by the built-in animations described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.