Skip to content

Conversation

tharropoulos
Copy link
Member

@tharropoulos tharropoulos commented Jun 11, 2025

TLDR

Add center-based expand/collapse transitions with spring physics animation.

Change Summary

Added Features:

  1. New Transition in collapse.go:

    • newCollapse(): Creates collapse transition with spring-based animation
    • View(): Implements edge-to-center collapsing effect using harmonica spring physics
    • Animation collapses content from edges toward center, revealing next content
  2. New Transition in expand.go:

    • newExpand(): Creates expand transition with spring-based animation
    • View(): Implements center-outward expanding effect
    • Animation expands new content from center while previous content remains on edges
  3. New Transition in fade.go:

    • fade struct: implements tile-based fade transition with spring physics
    • newFade(): creates fade transition with configurable FPS and spring parameters
    • tileGrid struct: manages randomized tile reveal order for fade effect
    • newTileGrid(): creates grid with shuffled tile order for organic fade animation
    • buildFadeLine(): constructs each line by combining revealed/unrevealed tiles
    • extractTileSegment(): handles proper text truncation for tile boundaries

Code Changes:

  1. In collapse.go:

    • Added complete collapse transition implementation with spring physics (frequency: 7.0, damping: 0.6)
    • Implements Transition interface with Start(), Update(), View(), Animating() methods
    • Uses edge-to-center animation logic with dynamic width calculations
  2. In expand.go:

    • Added complete expand transition implementation with matching spring configuration
    • Center-outward animation logic that's the visual opposite of collapse
    • Proper content truncation and positioning for smooth animation

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • Added three new smooth transition effects for text-based UIs: "collapse," "expand," and tile-based "fade," enhancing visual content changes with appealing animations.
  • Enhancements
    • Transition selection now includes "collapse," "expand," and "fade" options for richer and more dynamic user interface animations.
  • Documentation
    • Updated README to document the new transition effects and mark their addition as completed in the roadmap.

Copy link

coderabbitai bot commented Jun 11, 2025

Walkthrough

Three new animated text transitions—collapse, expand, and fade—were introduced for a terminal user interface. Each uses spring physics for smooth animation. The collapse transition shrinks content inward, expand grows content outward from the center, and fade reveals content tile-by-tile in a shuffled order. The transition selection logic was updated to support all three.

Changes

File(s) Change Summary
internal/tui/transitions/collapse.go Added collapse transition: struct, constructor, and methods for animation state, update, and rendering.
internal/tui/transitions/expand.go Added expand transition: struct, constructor, and methods for animation state, update, and rendering.
internal/tui/transitions/fade.go Added fade transition: tileGrid and fade structs, constructors, animation logic, and tile-based rendering.
internal/tui/transitions/transition.go Extended Get function to support "collapse", "expand", and "fade" transitions.
README.md Updated documentation to include new collapse, expand, and fade slide transitions with descriptions.

Sequence Diagram(s)

sequenceDiagram
    participant UI
    participant Transition (collapse/expand/fade)
    participant SpringPhysics

    UI->>Transition (collapse/expand/fade): Start(width, height, direction)
    loop Animation frames
        Transition (collapse/expand/fade)->>SpringPhysics: Update(progress, velocity)
        SpringPhysics-->>Transition (collapse/expand/fade): New progress, velocity
        Transition (collapse/expand/fade)->>UI: View(prev, next)
        UI-->>Transition (collapse/expand/fade): Schedule next frame (if animating)
    end
    Transition (collapse/expand/fade)->>UI: Animation complete
Loading

Poem

In the terminal garden where text can play,
Collapse folds inwards, hiding away.
Expand bursts outward, center to side,
Fade tiles reveal with shuffled pride.
Animated by springs, with physics as guide,
Rabbits hop with joy, for the UI grew wide!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@tharropoulos tharropoulos requested a review from ploMP4 June 11, 2025 07:37
coderabbitai[bot]

This comment was marked as spam.

@tharropoulos tharropoulos force-pushed the expand-collapse-transitions branch 2 times, most recently from eea6a9d to c41b60a Compare June 11, 2025 08:02
@tharropoulos tharropoulos changed the title feat(transition | tui): add expand and collapse transition animations feat(transition | tui): add expand, collapse and fade transition animations Jun 11, 2025
coderabbitai[bot]

This comment was marked as spam.

- add `expand.go` with center-outward expanding transition effect
- register expand transition in transition factory function
- implement spring-based animation with harmonica library
- add new `collapse.go` with collapse transition implementation
- implement edge-to-center collapsing animation with spring physics
- fix `expand.go` opposite method to return collapse instead of expand
- register collapse transition in transition factory
- add `fade.go` with fade transition effect
- register fade transition in transition factory function
- implement spring-based animation with harmonica library
@tharropoulos tharropoulos force-pushed the expand-collapse-transitions branch from be62190 to 9219329 Compare June 11, 2025 08:16
Copy link
Member

@ploMP4 ploMP4 left a comment

Choose a reason for hiding this comment

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

collapse transition flashes the next slide on the first frame

@tharropoulos
Copy link
Member Author

collapse transition flashes the next slide on the first frame

Huh? Can you post a screen recording of it?

@tharropoulos
Copy link
Member Author

@ploMP4 Can't replicate it on Alacritty 0c405d53, or ghostty 1.1.3-arch1, either in tmux, or not.

@ploMP4
Copy link
Member

ploMP4 commented Jun 13, 2025

collapse transition flashes the next slide on the first frame

Huh? Can you post a screen recording of it?

output.mp4

Here is a video that replicates the issue.

After further investigation I noticed that it only happens on ghostty and kitty, alacritty works fine. Running it inside and outside tmux gives the same results so tmux does not affect it.

Compositor: Wayland
Ghostty version: 1.1.3-arch1
Kitty version: 0.42.1
Alacritty version: 0.16.0-dev

@tharropoulos
Copy link
Member Author

collapse transition flashes the next slide on the first frame

Huh? Can you post a screen recording of it?

output.mp4

Here is a video that replicates the issue.

After further investigation I noticed that it only happens on ghostty and kitty, alacritty works fine. Running it inside and outside tmux gives the same results so tmux does not affect it.

Compositor: Wayland Ghostty version: 1.1.3-arch1 Kitty version: 0.42.1 Alacritty version: 0.16.0-dev

2025-06-14.01-04-56.mp4

What in the....?

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.

2 participants