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

feat(ui): setup screen mouse parallax effect #1467

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

peps
Copy link
Collaborator

@peps peps commented Feb 4, 2025

This adds a parallax effect to the setup section that reacts to the user's mouse. This adds a cool 3D effect and something to play around with while the setup screen is loading.

I also downsized and optimized the setup section images, so the performance impact and bundle size should be reduced.

Video demo:

https://www.loom.com/share/d40c35bb063245379a843328eeaa6a71?sid=82795738-c99e-49c7-93b4-9cbc8add0c81

@peps peps self-assigned this Feb 4, 2025
@peps peps changed the title feat(ui): setup screen parallax effect feat(ui): setup screen mouse parallax effect Feb 4, 2025
Copy link
Collaborator

@shanimal08 shanimal08 left a comment

Choose a reason for hiding this comment

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

yeeet very cool!

@brianp
Copy link
Collaborator

brianp commented Feb 4, 2025

I'm going to need someone to profile this. @shanimal08

@shanimal08
Copy link
Collaborator

I'm going to need someone to profile this. @shanimal08

it should be all good, using useMotionValue not useState, i was thinking this one goes in first and i can double check after updating my PR?

@brianp
Copy link
Collaborator

brianp commented Feb 4, 2025

@peps I'm going to leave this PR open because it's nice. The front end is currently eating a lot of memory in different places. This UX effect almost doubles memory usage during the setup screen. It does at least release the memory when we go to the main screen (where other things do not), but for now a doubling in memory isn't worth the UI benefit. If we can shrink the existing footprint I'll reconsider putting this in.

@brianp brianp added enhancement New feature or request a-ui on hold Issue is being held for progress later labels Feb 4, 2025
@peps
Copy link
Collaborator Author

peps commented Feb 4, 2025

@brianp I've made a few performance improvements.

  • Combined the 2 useMotionValue calls into 1 object
  • Moved some arrays and objects outside of the component so they don't calculate on every re-render
  • throttle the mouse movement by limiting it with requestAnimationFrame. So the mouse position is calculated at 60fps and doesn't trigger more times then needed.

It's strange that you're seeing double the memory usage. That shouldn't be the case. I heavily optimized the images on the setup screen so it should take up less memory than the previous build. Maybe the previous images are cached in memory?

@peps peps marked this pull request as draft February 5, 2025 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-ui enhancement New feature or request on hold Issue is being held for progress later
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants