Rebuilding My Home on the Web - Update #2
Published: 2023-01-29 18:19:26

---
title: Rebuilding My Home on the Web - Update #2
published: true
date: 2022-11-14 12:00:00 UTC
tags: 
canonical_url: https://brenden.codes/rebuilding-my-home-on-the-web-update-2
---

![A screenshot of the updated design with gradient and background pattern](https://a.storyblok.com/f/104216/1920x1062/3ba346e29e/update-2-intro.png)

This post is part of a series. You can view the other posts here: 
- [Original Post](https://brenden.codes/rebuilding-my-home-on-the-web)
- [Update #1](https://brenden.codes/rebuildingupdate-1)
- **Update #2 (You are here)**
- [Update #3](https://brenden.codes/rebuilding-my-home-on-the-web-update-3)
- [Update #4](https://brenden.codes/rebuilding-my-home-on-the-web-update-4)

My current landing page, uses [react-particles-js](https://github.com/Wufe/react-particles-js) to have an animation running in the background. 
![My current website with moving particles in the background](https://a.storyblok.com/f/104216/1918x1008/8fca1e86d0/update2-particles.gif)
I held off on re-implementing this until I was satisfied with the rest of the site because I wasn't ahead 100% sure I would keep it. 

I ultimately decided to do away with the particles for a few reasons: 
1. It made the page design look very busy. It easily draws the eye away from the content of the page and harms the overall experience, in my opinion.
2. Keeping it makes the site less accessible. With the particles, I'd have to add extra javascript this time around just to handle users who prefer reduced motion. In other places I can handle this with some straightforward CSS, and while I could _probably_ do that here too it seemed like a lot of work when users would get a better experience by just not implementing it.  
3. Performance. I've noticed in the past that the animations definitely behave differently on different devices. It wasn't horrible, but it was impacting some metrics like [LCP](https://web.dev/lcp/) on the page. [By not including it, I can ensure better performance across a wider range devices](https://www.youtube.com/watch?v=CYVs9hllqZY). 

But now the question was, what should replace the particles? Leaving it as it currently stood was a bit boring. 
![The page with a plain dark background and no particles. ](https://a.storyblok.com/f/104216/1680x889/e7c883bce2/update2-no-particles.png)

I decided to add a little depth via a gradient. This was fairly straightforward to do with tailwind. I just updated the styling of the background to be a gradient instead of a single color.
```html
<main className="
	  bg-gradient-to-r 
	  from-sky-800 via-amber-100 to-primary-light 
	  dark:from-primary-dark dark:via-cyan-700 dark:to-cyan-800">
</main>
```

After adjusting some of the font colors and weights it started to look much better, but was still feeling pretty flat. 
![Light and dark mode of the pages with the new gradients.](https://a.storyblok.com/f/104216/1526x609/3b86902f04/update2-gradients.png)

I found a few great SVG backgrounds at [Hero Patterns](https://heropatterns.com/) and, after adjusting them a bit so they weren't as prominent, added them via CSS to the page. I also decided that instead of just having one, I'll randomly select a pattern on page load and use that. To achieve that I created an array with the names of the patterns and on load, randomly selected the index of one of the patterns. 

```js 

// done outside of the component since these are static
const backgrounds = ['gears', 'circuit', 'diamonds'];


function randomNumber(min, max) {
	return Math.floor(Math.random() * (max - min) + min);
}

// further down in the actual component

const [bgPattern] = useState(
	backgrounds[randomNumber(0, backgrounds.length)]
);
  
return (
<section
	className={`${styles[bgPattern]}`}
	id="intro"
>
```


With the added texture from the background it looks much better, and not as busy as it did the particles. 
![Final version of the pages with gradient and pattern background on a desktop, tablet, and mobile device. ](https://a.storyblok.com/f/104216/1654x894/0bbbe9a827/update2-final.png)