5 ms·
Show HN: Giving a 2D grid a 3D look – part 3
- atum47 5y agoHi everyone. This week I've been working of some fake 3D effect over a 2D grid. I don't have a goal with this, I'm just making it for fun. The original code took me less then a hour to write and every iteration about 15-30 minutes. Today I was looking at some cool retro synthwave graphics [1] and I got inspired. To achieve this I'm measuring the distance of each column of points to the center of the grid and giving it a random height the decreases as it approaches the center. After a row of points have passed a z value (went outside of view) I pop them, reset their z position (depth) and give it a new y positions. This way I'm creating an endless loop of mountains. I also use the z distance to color the grid in this beautiful blue to red gradient with an alpha value (so the mountains fade in instead of just appearing out of nowhere). Well, I hope you like it. Part 1 - https://victorribeiro.com/random https://victorribeiro.com/random Part 2 - https://victorribeiro.com/random2 https://victorribeiro.com/random2 1 - https://www.google.com/search?q=retro+synth+graphics&sxsrf=AOaemvImZ1RO5yFpxrOqXSKKImoi6oFz0g:1637901540274&source=lnms&tbm=isch&sa=X&ved=2ahUKEwj-iPDbmrX0AhWtK7kGHTlvAUQQ_AUoAXoECAEQAw&biw=1920&bih=979&dpr=1 https://www.google.com/search?q=retro+synth+graphics&sxsrf=A...
- geoffbrown2014 5y agoDon't have much to add, but enjoyed it, cool.