feat: add PlaceholderTransitions presets for fade animations#1
Open
rainxchzed wants to merge 2 commits intoRevenueCat:mainfrom
Open
feat: add PlaceholderTransitions presets for fade animations#1rainxchzed wants to merge 2 commits intoRevenueCat:mainfrom
rainxchzed wants to merge 2 commits intoRevenueCat:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Goal
Introduce
PlaceholderTransitionsto simplify placeholder fade-in/fade-out animations with convenient presets.Currently, developers must manually create animation specs for transitions:
This PR adds discoverable presets:
Why this matters: Makes the API more accessible for common use cases while maintaining full customization for advanced needs.
🛠 Implementation Details
Changes:
PlaceholderTransitionsobject with 6 presets:fast,normal,smooth,slow,snappy,bouncycustom()andtween()for fine-grained controlDesign decisions:
PlaceholderTransitions(notAnimationDefaults) to clearly distinguish fromPlaceholderDefaults(which provides highlight effects like shimmer/fade/pulse)() -> FiniteAnimationSpec<Float>to match exact parameter signatureKey distinction:
PlaceholderDefaults= animated effects on the placeholder (shimmer, pulse, etc.)PlaceholderTransitions= how placeholder appears/disappears✍️ Examples
Basic usage:
Different in/out transitions:
Custom timing:
Available presets:
fast- 200ms tween for quick loadingnormal- Default spring for balanced motionsmooth- Low stiffness spring for elegant transitionsslow- 800ms tween for deliberate loadingsnappy- High stiffness spring for instant feelbouncy- Low damping spring for playful effectDemo video:
Screen_recording_20251015_064300.webm
✅ Prepare for Review
API changes:
PlaceholderTransitions