Another week, another lesson. Just wrapped up a Galaxy Generator for my Three.js sandbox. This build is all about particles and procedural generation. I used sine and cosine to calculate angles and bend straight lines into spiral arms, then applied power functions to naturally scatter the particles from a dense core to dispersed edges. To get the colors right, I used lerp to smoothly blend the hot inside with the cooler outside branches. I also wired up a control panel in the top right. You can mess with the particle count, branch structure, colors, and randomness to generate your own setup. Go tweak the settings and see what you can create here: https://lnkd.in/grJj9Azr #threejs #javascript #webgl #webdevelopment"
More Relevant Posts
-
🐌 Your React list has 10,000 items… …and scrolling feels like loading a 2009 Flash game. There’s a fix most juniors aren’t told about 👇 ✨ Virtualization 💡 The idea is simple: Only render what the user can actually see. Instead of 10,000 DOM nodes, you keep ~50 visible ones …and dynamically swap content as the user scrolls. 🧰 Libraries to use: → react-window ▫️ Lightweight ▫️ Best for fixed-height items → react-virtual ▫️ More flexible ▫️ Supports dynamic heights 💻 Example: import { FixedSizeList } from 'react-window'; <FixedSizeList height={600} itemCount={10000} itemSize={50} width="100%" > {({ index, style }) => ( <div style={style}>Item {index}</div> )} </FixedSizeList> ⚡ Result: ✔️ Lean DOM ✔️ Smooth performance ✔️ Massive speed boost This one change can take you from ⏳ ~3s render → under 100ms 📌 Next time someone says: "Just paginate it" …you know what to show them 😉 #ReactJS #WebPerformance #FrontendDev #JavaScript
To view or add a comment, sign in
-
I built infinite grass in the browser. And you can drive a Jeep through it. No, seriously. Open it on your phone right now and drive around. Here is what is actually happening under the hood: A 250x250 grid of grass instances rendered with InstancedMesh. As the Jeep moves, tiles at the back get recycled to the front. The grass never ends. The memory stays flat. The framerate holds. This technique is sometimes called a scrolling tile grid or infinite terrain chunking. It is the same idea behind open-world games where the world "loads" around the player. I just brought it to the browser with React Three Fiber and TSL (Three.js Shading Language). Big thanks to Bruno Simon whose video gave me the initial direction. I watched it, understood the concept, then built the whole thing myself (with a lot of AI assistance for the shader math, not going to lie). But the architecture decisions, the debugging, the "why is every blade of grass pointing straight up" moments at 2am? That was me. If you have been sleeping on React Three Fiber + TSL, this combo is genuinely exciting right now. TSL in particular makes writing custom shaders feel like actual JavaScript instead of a different language. https://lnkd.in/gDxisWsV #webdev #tsl #react #typescript
To view or add a comment, sign in
-
Calling all JavaScript developers! I've got a tricky closure question that might just make you scratch your head. Can you solve this? function createCounter() { let count = 0; return function() { count++; console.log(count); }; } const counter1 = createCounter(); const counter2 = createCounter(); counter1(); counter1(); counter2(); What will be logged to the console, and why? 🤔 Share your answers and explanations below! Let's see who cracks it. 👇 #JavaScript #Closures #CodingChallenge #WebDevelopment
To view or add a comment, sign in
-
-
🔁 React hooks run in a specific order. Every single render. Most devs don't know this. And it causes bugs. 👇 On every render, this is the exact order: 1️⃣ Function body runs — useState, useRef, useContext initialize 2️⃣ useMemo and useCallback compute their values 3️⃣ React updates the DOM 4️⃣ useLayoutEffect fires — before the browser paints 5️⃣ Browser paints the screen 6️⃣ useEffect fires — after everything is visible On unmount: useLayoutEffect cleanup → useEffect cleanup → component gone The one thing worth memorizing: useLayoutEffect = before paint useEffect = after paint That single difference explains every flicker bug you've ever had. Did you know the exact order before this? 👇 #ReactJS #JavaScript #Frontend #WebDevelopment #Programming
To view or add a comment, sign in
-
-
🧠 Day 19 of 21days challenge Event Propagation in JavaScript ⚡ Events don’t just happen… they travel. By default, events follow bubbling (child → parent). But we can also use capturing (parent → child). For easy understanding :- Capturing = top to bottom Bubbling = bottom to top Default = bubbling 👉 That’s how DOM events flow This changed how I debug UI events 🚀 #JavaScript #EventPropagation #Frontend #InterviewPrep
To view or add a comment, sign in
-
-
#Hello #Connections 👋 #100DaysOfCodeChallenge | #Day55 Project: Snake Game What I built Today I built a classic Snake Game using JavaScript. The snake moves across a grid, eats food to grow, and the game ends if it hits the wall. Technologies Used HTML5 CSS3 JavaScript (Game Logic, DOM Manipulation, Events) Note This project is still in progress — I’m actively working on adding more features like score tracking, increasing speed, and better game mechanics. Challenge I faced Managing the continuous movement and game state updates while keeping the UI synced with the logic. How I solved it Used a game loop with setInterval and maintained state for snake position, direction, and food to update the board dynamically. Live Demo: https://lnkd.in/dKDHr-sy Open to feedback and suggestions Code Of School Avinash Gour | Ritendra Gour #FrontendDeveloper #JavaScript #GameDevelopment #WebDevelopment #100DaysOfCode #DeveloperJourney #Coding
To view or add a comment, sign in
-
Everyone loves arrow functions. They’re concise, "modern," and they solve the 'this' binding issue without breaking a sweat. But if you’re building for scale, you need to look under the hood. The secret of inline arrow functions in your JSX? Referential Equality. Every single time your component re-renders, that arrow function is a brand-new object in memory. If you’re passing that function to a child component optimized with 'React.memo', you’ve just killed your optimization. The child sees a "new" prop, triggers a re-render, and your performance goes out the window. This is where the 'bind' method, specifically when used in a constructor or a stable context, historically won. It allowed you to create a stable reference. By binding once, you ensured that the function identity remained the same across every render, keeping your component tree lean. In the era of Hooks, we’ve moved toward 'useCallback' to achieve this same stability, but the fundamental engineering principle remains same, that is, stop creating throwaway functions in your render path. #ReactJS #WebPerformance #SoftwareEngineering #Javascript #CodingTips
To view or add a comment, sign in
-
Turned my ASCII text scramble hover effect into a full-screen playground. Radial waves that expand from the cursor and scramble chars. Added a GUI for you to play with. Fun experiment but not sure it's very useful, might as well read some Lovecraft while you're there. Vanilla JS kept under 10k (gzipped) and only dependency is lil-gui for the control panel. → CodePen link: https://lnkd.in/dHrq789e #creativecoding #javascript #codepen #frontend #vanillajs
To view or add a comment, sign in
-
DAY 14 — The Dependency Array Is a Contract THE DEPENDENCY ARRAY IS A CONTRACT Lying to useEffect's dependency array is one of the most common React mistakes. The eslint-plugin-react-hooks rule exists for a reason. If you omit a variable from the deps array, your effect runs with a stale closure. If you include everything correctly, the effect re-runs when any dep changes. The temptation is to add [] to "run once" — but if your effect uses state or props, you're creating a silent bug. The real fix is to rethink the effect's structure, not silence the linter. Empty deps [] means "I swear this effect uses nothing from the component." If that's not true, you have a bug. How many times has the linter saved you from yourself? 👇 #useEffect #ReactHooks #BestPractices #JavaScript
To view or add a comment, sign in
-
-
🎮 Just built the Classic Simon Game using HTML, CSS & JavaScript! For those who don't know — Simon is a memory-based game where the game shows you a sequence of colors & sounds, and you have to repeat it correctly. With every level, the sequence gets longer and harder! 🧠⚡ It's simple to play but seriously tests your memory and focus! 🛠️ Tech Used: → HTML — Game structure → CSS — Styling & color buttons → JavaScript — Game logic, sequences & event handling ✅ What I practiced: → DOM Manipulation → Event Listeners → Arrays & random sequence generation → setTimeout for animations #JavaScript #HTML #CSS #WebDevelopment #Frontend#LearningInPublic #100DaysOfCode
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development