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

Animation: part 2 #1253

Merged
merged 22 commits into from
May 19, 2024
Merged

Animation: part 2 #1253

merged 22 commits into from
May 19, 2024

Conversation

yshui
Copy link
Owner

@yshui yshui commented May 8, 2024

What

This PR adds a scripting system that supports simple easing curves, and simple arithmetic. And a animation system based on scripts.

This PR also adds a shim to support old fading configs on top of this new animation system.

Why

Originally my plan was to implement animations on top of just easing curves, but I slowly realized that this is not flexible enough. Suppose I want to have windows fly out when closed, how do I define the end point of the animation curve? It's not straightforward, because to move the window completely off-screen, the end Y coordinate will depend on the height of the window.

Sure, I can have some predefined values, like "upwards-off-screen", to mean a Y coordinate that will move the window off the top edge of the screen. But it's impossible to anticipate what kind of animation users might want. So I thought, we might as well to go for maximal customizability.

So for this example, you would write a script like this:

animations = ({
    triggers = ["close", "hide"];
    offset-y = {
        timing = "1s linear";
        start = 0;
        end = "-window-height - window-y";
    };
    opacity = 1; # This is needed because when a window is closed, it's opacity automatically becomes 0
})

Showcase

a.mp4

TODO

1. Presets

Although you can define all kinds of animations with this system, I do understand not everybody would want to learn how to use this, if all they want is just some simple animations. The plan is to add a "preset" system, so users can config simple animations, like "fly-out", "fade-out", etc., without needing to write these scripts.

2. Bugs

There are still many bugs to be crushed here.

3. Documentation

We need to explain how the script works. Explain what's the syntax for curves, for simple arithmetic expressions. And warn users about common pitfall (e.g. you need to explicit set opacity = 1;, otherwise your window disappears).

@yshui yshui mentioned this pull request May 8, 2024
@yshui yshui force-pushed the animation-part2 branch 6 times, most recently from caee428 to 7010c8c Compare May 9, 2024 02:38
Copy link

codecov bot commented May 9, 2024

Codecov Report

Attention: Patch coverage is 79.22078% with 272 lines in your changes are missing coverage. Please review.

Project coverage is 44.19%. Comparing base (02a7c71) to head (6624f09).

Current head 6624f09 differs from pull request most recent head 91ffbb4

Please upload reports for the commit 91ffbb4 to get more accurate results.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             next    #1253      +/-   ##
==========================================
+ Coverage   41.03%   44.19%   +3.15%     
==========================================
  Files          59       60       +1     
  Lines       12277    13256     +979     
==========================================
+ Hits         5038     5858     +820     
- Misses       7239     7398     +159     
Files Coverage Δ
src/common.h 44.82% <ø> (ø)
src/config.c 51.56% <ø> (ø)
src/config.h 23.52% <ø> (ø)
src/renderer/layout.c 97.97% <100.00%> (+0.95%) ⬆️
src/utils.h 32.07% <100.00%> (+2.66%) ⬆️
src/win.h 97.61% <ø> (-2.39%) ⬇️
src/dbus.c 25.12% <0.00%> (ø)
src/event.c 69.77% <83.33%> (-0.32%) ⬇️
src/renderer/damage.c 89.71% <71.42%> (-0.69%) ⬇️
src/backend/gl/gl_common.h 5.35% <0.00%> (ø)
... and 14 more

... and 7 files with indirect coverage changes

@yshui yshui force-pushed the animation-part2 branch 6 times, most recently from 54ee997 to 958a64f Compare May 9, 2024 04:11
@yshui yshui marked this pull request as ready for review May 9, 2024 04:13
@yshui yshui force-pushed the animation-part2 branch 14 times, most recently from 2dcc5df to f4b24d3 Compare May 12, 2024 16:51
yshui added 19 commits May 19, 2024 22:04
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
We should always process all the X events in libxcb's queue with the
server grabbed, not just when we have `pending_updates` flag set.

This is the only way to make sure we always render with up-to-date
server states.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Remove the old fading machinary. As a side-effect, animation and time
based shaders are now unified.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
An attempt to make rendering with damage deterministic even when
replayed from a trace.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This can be used to prevent another animation from interrupting the
current running animation.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Define script context variables describing the monitor a window is on.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
@yshui
Copy link
Owner Author

yshui commented May 19, 2024

Alright, let's merge this!

@yshui yshui enabled auto-merge May 19, 2024 21:04
@yshui yshui merged commit 315bd32 into next May 19, 2024
16 checks passed
@yshui yshui deleted the animation-part2 branch May 19, 2024 21:06
@DarioDarko
Copy link
Sponsor

DarioDarko commented May 19, 2024

[ 20.05.2024 00:08:40.431 c2_parse_target WARN ] Type specifier is deprecated. Type "a" specified on target "_NET_WM_STATE" will be ignored, you can remove it.
[ 20.05.2024 00:08:40.431 c2_parse_target WARN ] Format specifier is deprecated. Format "32" specified on target "_NET_WM_STATE" will be ignored, you can remove it.
[ 20.05.2024 00:08:40.431 c2_parse_target WARN ] Type specifier is deprecated. Type "c" specified on target "_GTK_FRAME_EXTENTS" will be ignored, you can remove it.
BUG_ON: "err != NULL"
zsh: IOT instruction (core dumped) ./picom

im not sure if i did something wrong, i dont compile usually. this is the current next branch

this was my approach of compiling

git clone https://github.com/yshui/picom --branch animation-part2
cd picom
meson setup --buildtype=release build
ninja -C build
cd build
cd src
./picom

i use endeavourOS and openbox

thanks for your work btw <3 looking forward to the animations

@yshui
Copy link
Owner Author

yshui commented May 19, 2024

@DarioDarko can you provide your config file?

@enderprism
Copy link

enderprism commented May 20, 2024

i have this issue as well. commenting out the animation sections doesn't solve it.

System info

  • OS: EndeavourOS
  • Picom version: latest picom-git from the Chaotic AUR
  • WM: i3-wm
  • CPU: 12th Gen Intel(R) Core(TM) i5-12450H (12) @ 4,40 GHz
  • GPU: NVIDIA GeForce RTX 4050 Laptop

Picom config

picom.conf

@yshui
Copy link
Owner Author

yshui commented May 20, 2024

@enderprism hmm, i can't reproduce it. do you mind open an issue? please include a --log-level=trace log if you do.

@DarioDarko can you do the same as well? thanks.

@DarioDarko
Copy link
Sponsor

DarioDarko commented May 20, 2024

i opened the issue

#1263

FIXED :) works now!

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 this pull request may close these issues.

None yet

7 participants