Skip to content

Bind animation primitives: AnimatedVisibility, AnimatedContent, Crossfade #56

@jonathanpeppers

Description

@jonathanpeppers

None of the core Compose animation entry points are wrapped today. They're the standard way to add enter/exit transitions, value-keyed swaps, and crossfade in any non-static UI.

Missing composables

Composable Kt class
AnimatedVisibility AnimatedVisibilityKt
AnimatedContent AnimatedContentKt
Crossfade CrossfadeKt

Notes

  • AnimatedVisibility takes EnterTransition / ExitTransition parameters — these are non-composable factory functions (fadeIn(), slideInVertically(), etc.) from EnterExitTransitionKt. The simplest first cut can just default both and let the runtime pick the default fade.
  • AnimatedContent takes a state value and a ContentTransform (built via togetherWith from enter+exit). The content lambda is @Composable (T) -> Unit — needs a generic-over-state-value shape on the C# side, or specialise it (AnimatedContent<int>).
  • Crossfade is the easiest of the three — Crossfade(targetState: T, content: @Composable (T) -> Unit). Probably the right one to ship first as a smoke test of the shape.

Approach

These have IFunction* content lambdas with a state-value parameter, so use ComposableLambdas.Wrap2 (or higher) to give Compose a stable identity per the project conventions in .github/copilot-instructions.md.

Tracking

Long-term dotnet/java-interop#1440.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions