Skip to content

UI: Add Transitions to arcade GUI [after 3.0 release]#1420

Merged
eruvanos merged 11 commits into
developmentfrom
gui/transitions
Jul 10, 2026
Merged

UI: Add Transitions to arcade GUI [after 3.0 release]#1420
eruvanos merged 11 commits into
developmentfrom
gui/transitions

Conversation

@eruvanos

@eruvanos eruvanos commented Nov 30, 2022

Copy link
Copy Markdown
Member

Adds a complete GUI animation stack to Arcade, shipped under arcade.gui.experimental so the novel per-property takeover semantics, cached overdraw and hover-zone behavior can be iterated on without deprecations. Stabilization later is purely additive (e.g. promoting animate() onto UIWidget once proven).

High-level API

UIAnimatedGroup is the main entry point. It wraps a single child (or a whole subtree), renders it into a cached surface, and tweens transform properties that do not affect layouting:

from arcade.gui.experimental import UIAnimatedGroup

group = UIAnimatedGroup(child=UIFlatButton(text="Play"))
layout.add(group)

# scale to 108% within 0.15s, with a "back out" overshoot
group.animate(scale=1.08, duration=0.15, ease=Easing.BACK_OUT)

Animatable transform properties: scale, angle, alpha, offset_x, offset_y, tint.

animate() supports:

  • multiple properties per call
  • sequencing via .then(...), completion callbacks via .on_finish(...), cancellation via .stop()
  • repetition (repeat, yoyo), delays, easing (arcade.anim.Easing)
  • relative targets via rel() (e.g. angle=rel(-360))
  • per-property takeover: starting a new animation takes over just its properties from running ones — so hover in/out is a one-liner with no cleanup.

UIAnimatedGroup is interactive: hovered / pressed / on_click are hit-tested against the group's untransformed rect, so the trigger zone stays stable while the visuals scale or rotate. The child subtree still receives mouse events transformed into its local coordinate system.

def on_hover_change():
    if group.hovered:
        group.animate(scale=1.08, duration=0.15, ease=Easing.BACK_OUT)
    else:
        group.animate(scale=1.0, duration=0.15)

bind(group, "hovered", on_hover_change)

UIRenderGroup is the non-interactive caching primitive underneath, available for use on its own.

Low-level transitions

animate() is built on a small set of composable Transition* primitives (also exported from arcade.gui.experimental), which can be combined with + (parallel) and | (sequential):

  • TransitionAttr — tween a value over time (start → end)
  • TransitionAttrIncr — increment a value over time
  • TransitionAttrSet — set a value after a delay
  • TransitionParallel — run transitions in parallel
  • TransitionChain — run transitions sequentially
  • TransitionDelay — pause within a chain

Animation implements the TransitionBase protocol, so animations and raw transitions compose freely.

Examples

  • arcade.examples.gui.exp_animations — an animated main menu: staggered pop-in entrances, pulsing/swaying idle animations, hover pops, spinning tiles, fade-out on quit.
  • arcade.examples.gui.exp_animations_2 — hoverable cards that lift and enlarge.
  • arcade.examples.gui.transitions — a minimal low-level showcase animating offset_x/offset_y.

Docs & tests

  • New programming guide page doc/programming_guide/gui/animations.rst plus updates to concepts.rst; the experimental API is indexed under GUI Experimental Features.
  • Full unit coverage in tests/unit/gui/ for animate, transition, and the render/animated groups (parent-space hover, transform-invariant hit-testing, ticking, takeover semantics).

Notes

  • Supporting changes to the GUI render path (surface.py + the surface_vs/fs.glsl shaders), the reactive property.py system (adds AliasProperty), and UIScrollArea came along on this branch.
  • Everything animation-related lives in arcade.gui.experimental — the stable arcade.gui namespace does not export any of it yet.

@eruvanos eruvanos force-pushed the gui/transitions branch 2 times, most recently from 45b769d to 4feea13 Compare December 4, 2022 03:25
@eruvanos eruvanos added the gui Related to arcade GUI (sub module arcade.gui) label Jan 12, 2023
@eruvanos

Copy link
Copy Markdown
Member Author

Talked to @einarf :

  • missing feature: cancel transition
  • for Sprites, this might be a performance problem

@eruvanos

eruvanos commented Jan 16, 2023

Copy link
Copy Markdown
Member Author

Will be added after 3.0 release. It is more important to release!

@eruvanos eruvanos changed the title UI: Add Transitions to arcade GUI UI: Add Transitions to arcade GUI [after 2.7 release] Jan 24, 2023
@eruvanos eruvanos changed the title UI: Add Transitions to arcade GUI [after 2.7 release] UI: Add Transitions to arcade GUI [after 3.0 release] Feb 24, 2023
@eruvanos eruvanos marked this pull request as draft November 8, 2023 21:31
@eruvanos eruvanos force-pushed the gui/transitions branch 2 times, most recently from 060c1ff to 3bcdc28 Compare December 26, 2025 22:11
@eruvanos eruvanos marked this pull request as ready for review July 9, 2026 20:32
@eruvanos eruvanos merged commit 6936399 into development Jul 10, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gui Related to arcade GUI (sub module arcade.gui)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant