Skip to content

feat: add enter opacity transition to bars#612

Merged
hcopp merged 5 commits intomasterfrom
hunter/bar-transition-enter-opacity
Apr 13, 2026
Merged

feat: add enter opacity transition to bars#612
hcopp merged 5 commits intomasterfrom
hunter/bar-transition-enter-opacity

Conversation

@hcopp
Copy link
Copy Markdown
Contributor

@hcopp hcopp commented Apr 13, 2026

What changed? Why?

This PR adds enterOpacity to bar animations, which has a default of 150 ms. Before, bars didn't animate opacity and thus would be at 100% opacity with their minimum size until animating to their target path. This left a weird starting position with the stagger delay + initial size where bars would sit there fully visible.

Adding this opacity transition solves it. The values came from motion.

Root cause (required for bugfixes)

No bug here, this was a known missing feature when we supported min size.

UI changes

Description Before After
Web
BeforeTrimmed.mov
AfterTrimmed.mov
Mobile
MobileBefore.mp4
MobileAfter.mp4

Testing

Test this on mobile and web with bar chart (and test all other charts).

How has it been tested?

  • Unit tests
  • Interaction tests
  • Pseudo State tests
  • Manual - Web
  • Manual - Android (Emulator / Device)
  • Manual - iOS (Emulator / Device)

Testing instructions

Illustrations/Icons Checklist

Required if this PR changes files under packages/illustrations/** or packages/icons/**

  • verified visreg changes with Terran (include link to visreg run/approval)
  • all illustration/icons names have been reviewed by Dom and/or Terran

Change management

type=routine
risk=low
impact=sev5

automerge=false

@cb-heimdall
Copy link
Copy Markdown
Collaborator

cb-heimdall commented Apr 13, 2026

✅ Heimdall Review Status

Requirement Status More Info
Reviews 2/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 1
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1
CODEOWNERS ✅ See below

CODEOWNERS

Code Owner Status Calculation
ui-systems-eng-team 2/1
Denominator calculation
Additional CODEOWNERS Requirement
Show calculation
Sum 0
0
From CODEOWNERS 1
Sum 1

@hcopp hcopp self-assigned this Apr 13, 2026
},
]}
stackGap={stackGap}
transitions={{ enter: { type: 'timing', duration: 5000, delay: 2000 } }}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I feel like this doesn't need to be covered in docs or storybook (since it is an obvious fix), there was this one example in storybook with a weirdly long delay and duration.

const enterTransitionWithStagger = useMemo(
() => withStaggerDelayTransition(enterTransition, normalizedStagger),
[enterTransition, normalizedStagger],
);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We split enter and enter with stagger so that we can use the pre staggered enter transition.


hasAnimatedEnterOpacity.current = true;
enterOpacity.value = buildTransition(1, enterOpacityTransition);
}, [animateEnterOpacity, isReady, enterOpacityTransition, enterOpacity]);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On mobile we need to track opacity transition and build the transition ourselves.

@hcopp hcopp marked this pull request as ready for review April 13, 2026 18:21
@hcopp hcopp requested a review from sverg-cb April 13, 2026 18:21
return {
...enterOpacityTransition,
delay: enterOpacityTransition.delay ?? enterTransition?.delay,
staggerDelay: enterOpacityTransition.staggerDelay ?? enterTransition?.staggerDelay,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We fallback to the default delay and staggerDelay of the enter transition, this should help with any custom transitions and should prevent and breaking issues with custom transitions (which likely don't exist but best to be safe).

* Transition for the initial enter opacity animation.
* Uses a default subtle fade when undefined (unless `enter` is disabled).
* @note falls back to `enter` timing offsets (`delay` and `staggerDelay`) when not provided.
* Set to `null` to disable enter opacity animation. Automatically set to null if enter transition is disabled.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flagging our custom logic for delay and staggerDelay on enterTransition (where it falls back to enter values).

Copy link
Copy Markdown
Contributor

@sverg-cb sverg-cb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your clarifying comments 🚀

@hcopp hcopp merged commit 092a4a2 into master Apr 13, 2026
39 of 41 checks passed
@hcopp hcopp deleted the hunter/bar-transition-enter-opacity branch April 13, 2026 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants