Skip to content

Conversation

@freakdaniel
Copy link

Since I use AnimatedContent in my projects, I have been modifying the component to suit my needs as I use it. For this reason, I decided to make this pull request, as I believe that enough has been fixed and added that beginners would really need

KEY CHANGES

  1. Safe Cleanup
    Before: The component used ScrollTrigger.getAll().forEach(t => t.kill()) on unmount. This killed ALL scroll triggers on the page, breaking animations in other components
    After: Now correctly stores references to the specific timeline and trigger instance, killing only its own processes

  2. Custom Scroller Support
    Added logic to detect specific scroll containers (via container prop or snap-main-container id)
    Essential for layouts using overflow: scroll, CSS Scroll Snap, or third-party scroll libraries where the window is not the scroller

  3. Exit Animations
    Introduced disappearAfter, disappearDuration, and disappearEase props. Elements can now animate out automatically after the entry animation completes

  4. Technical
    Switched from gsap.to to gsap.timeline for better control over animation sequencing (Entry -> Delay -> Exit).

Testing

  1. Verify that animations still work in the main window flow
  2. Test inside a nested scroll container (pass the container ref)
  3. Navigate away from the page and back to ensure other animations are not broken (cleanup check)
  4. Test the disappearAfter={2} prop to see the exit animation

- Replace global ScrollTrigger cleanup with instance-specific kill() to prevent side effects
- Add `container` support for custom scroll proxies (CSS snap or locomotive-scroll)
- Update  animation logic from `gsap.to` to `gsap.timeline`
- Implement disappear animation and speciefic props
- Fix animation glitch by setting initial visibility to hidden
@DavidHDev
Copy link
Owner

All 4 variants need to be kept in sync, please also modify the other 3 if you want to get this merged 😁

@freakdaniel
Copy link
Author

All 4 variants need to be kept in sync, please also modify the other 3 if you want to get this merged 😁

It seems that I don't fully understand what synchronization is being discussed, and what options are mentioned in the message. Please explain to me

@DavidHDev
Copy link
Owner

Each React Bits component comes in 4 variants:

  • JS with CSS (your changes have been made here) - /content
  • JS with Tailwind - /tailwind
  • TS with CSS - /ts-default
  • TS with Tailwind - /ts-tailwind

When making a change in one of the components, all 4 variants should be kept in sync with the new modified code.

@freakdaniel
Copy link
Author

Each React Bits component comes in 4 variants:

* JS with CSS (your changes have been made here) - /content

* JS with Tailwind - /tailwind

* TS with CSS - /ts-default

* TS with Tailwind - /ts-tailwind

When making a change in one of the components, all 4 variants should be kept in sync with the new modified code.

Done

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