ladunjexa / reactjs18-3d-portfolio

incredible 3D developer portfolio website with awesome graphics - built with React & Three.js 🪄
https://threejs-3-d-portfolio.vercel.app
MIT License
413 stars 163 forks source link

Help Needed #19

Open TiwariAbhishek23 opened 11 months ago

TiwariAbhishek23 commented 11 months ago

Hello, I updated this portfolio for my own here is the Link. I want to add a video clip that starts on hover, instead of normal image of my project in Work section, I tried to use this React-hover module but it is not working because of project structure, react-dependencies. I will be thankful if you can guide me for this

ladunjexa commented 10 months ago

Hi AbhishekTiwari23, It's been a while since your issue was published, but I saw on your site that you haven't implemented it yet so I'll share my two cents with you. In my opinion, you don't need to use any 3d party libraries, html video element (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video), onMouseEnter & onMouseLeave event handlers and useRef hook may be sufficient for this.

Here is a basic example of how you should implement this:

const videoRef= useRef(null);
const onMouseEnter = () => ref.current.play();
const onMouseLeave = () => ref.current.pause();

<video ref={videoRef}>
    <source src={source} type='video/mp4' onMouseEnter={onMouseEnter } onMouseLeave={onMouseLeave } />
</video>

Hope this helps you :)

TiwariAbhishek23 commented 5 months ago

Hi, I need little help, I updated the code as per the latest update and made the required changes, you can check them here - https://github.com/ladunjexa/reactjs18-3d-portfolio/compare/main...AbhishekTiwari23:tiwariabhishek23:main why after deploying it is becoming like

Screenshot 2024-05-09 at 3 10 28 AM