Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does Blur Fade component support fade out or not? #512

Open
LikeDreamwalker opened this issue Jan 15, 2025 · 1 comment
Open

Does Blur Fade component support fade out or not? #512

LikeDreamwalker opened this issue Jan 15, 2025 · 1 comment

Comments

@LikeDreamwalker
Copy link

Well I see this on documentation and I was thinking that it should has a trigger and support to switch the rendering, between blur in and blur out.
image

And I don't know if this is a bug or it was designed to achieve this, that it will only support fade in, or I use it wrong:
无标题视频——使用Clipchamp制作

Here is my demo code:

import React, { useState, useEffect } from 'react';
import BlurFade from '@/components/ui/blur-fade'; // Adjust the import path as needed

const BlurFadeDemo = () => {
  const [inView, setInView] = useState(false);

  useEffect(() => {
    const intervalId = setInterval(() => {
      setInView((prev) => !prev);
    }, 2000);

    return () => clearInterval(intervalId); // Cleanup interval on component unmount
  }, []);

  return (
      <div className="flex justify-center items-center h-screen">
        <BlurFade duration={1} inView={inView}>
          <div className="p-10 bg-blue-500 text-white text-center">
            This content will blur in and out every 2 seconds.
          </div>
          <div className="p-10 bg-blue-500 text-white text-center">
            {`${inView}`}
          </div>
        </BlurFade>
      </div>
  );
};

export default BlurFadeDemo;

So I think if Blur Fade doesn't support fade out for now, we should remove the fade out part in the document, which can make the readers confused, and I hope we can support this feature; Also if I understand it wrong, please let me know.

@LikeDreamwalker
Copy link
Author

I think I understand it now. Blur Fade will decide if the content should have the animation by the observer, and inView is to force the Blur Fade to think the content is in viewport now. That's why inView cannot be used to trigger the blur out effect.

However I still think to provide a manual way to control the blur in and out would be much better, especially for some async scenarios, like images and videos that can't be confirmed if it is visually rendered when they are actually in view, this can cause to the failure of the blur in and out.

I will keep this issue open for the official reply and I am really looking forward to it. And if the manual idea is okay and needed, I would be happy to contribute.

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

No branches or pull requests

1 participant