• About Us
  • Privacy Policy
  • Disclaimer
  • Contact Us
AimactGrow
  • Home
  • Technology
  • AI
  • SEO
  • Coding
  • Gaming
  • Cybersecurity
  • Digital marketing
No Result
View All Result
  • Home
  • Technology
  • AI
  • SEO
  • Coding
  • Gaming
  • Cybersecurity
  • Digital marketing
No Result
View All Result
AimactGrow
No Result
View All Result

Dissecting a Wavy Shader: Sine, Refraction, and Serendipity

Admin by Admin
October 25, 2025
Home Coding
Share on FacebookShare on Twitter



Each inventive studio has its bizarre inner rituals.

Ours? A problem we name “12 Pens in 12 Months” — one experiment every month, no guidelines, no shoppers, simply play.

Someplace between caffeine and chaos, considered one of our devs made this — a wavy, hypnotic, jelly-like movement impact that immediately turned the workforce’s favourite. We didn’t plan to make something “severe”, however individuals began asking the way it works, and right here we’re — writing about it on Codrops!

The Idea

The thought began easy:

What if we may make movement that feels natural — not mechanical, not linear, however one thing that flows?

We needed that “liquid between two worlds” really feel — a movement that appears to breathe, stretch, and chill out.

At its core, it’s a mixture of:

  • fragment shaders (to generate geometric wave-like cells)
  • math-driven distortion (sine waves, ripples, and refraction)
  • and requestAnimationFrame for easy, steady GPU updates.
perform draw(tms) {
  const t = tms * 0.001;

  // natural movement: a sine wave that lightly distorts the grid measurement over time
  const wave = Math.sin(p.x * 0.01 + p.y * 0.015 + t) * 0.25;
  const localCell = cell * (1.0 + wave * 0.2);

  // ripple impact triggered by consumer interplay (click on)
  float ripple = sin(R * 0.06 - dt * 6.0) * env;

  // mixing the glass-like refraction with the bottom picture
  vec3 col = combine(base, glass, inside);

  gl_FragColor = vec4(col, 1.0);
}

requestAnimationFrame(draw);

How It Works

The magic trick right here is in how we recalculate the wave path each body.

As a substitute of animating DOM or CSS properties, we rebuild each pixel dynamically within the shader — body by body.

Every cell behaves like a residing floor — pulsing, refracting, and rippling with time.

Think about drawing a line with a rubber band — every anchor level follows the one earlier than it, with a little bit of delay and overshoot. That delay provides us that deliciously gooey, alive motion.

For efficiency causes, we use:

  • requestAnimationFrame for easy updates.
  • GPU-driven math — sine, refraction, ripple computed instantly within the shader.
  • requestAnimationFrame to sync GPU frames with the browser’s refresh fee.
// discover the closest cell heart primarily based on the chosen form
void nearestCenter(int form, vec2 p, float cell, out vec2 c, out vec2 lp) {
  if (form == 0) {
    vec2 qr  = hex_pixel_to_axial(p, cell);
    vec2 qrr = hex_axial_round(qr);
    c = hex_axial_to_pixel(qrr, cell);
    lp = p - c;
  } else {
    vec2 g = flooring(p / cell + 0.5);
    c = g * cell;
    lp = p - c;
  }
}

Presets & Variations

As soon as the core system was working, we couldn’t cease tweaking it.

As a substitute of mounted presets, we constructed a easy management panel — 4 sliders that management the shader parameters instantly:

  • Cell measurement (uCell) — density of the grid
  • Amplitude (uAmp) — power of refraction
  • Chromatic shift (uChrom) — quantity of colour separation
  • Velocity (uSpeed) — how briskly the wave evolves

Altering simply considered one of these immediately transforms the temper of the movement — from mushy and fluid to sharp and energetic.

Each body, the app reads the dwell values from the sliders and sends them straight into the shader —

so any tiny change immediately ripples via the complete floor.

perform draw(tms) {
  const t = tms * 0.001;

  // dwell parameters from the UI → shader
  gl.uniform1f(uCell,   parseFloat(cellInp.worth));
  gl.uniform1f(uAmp,    parseFloat(ampInp.worth));
  gl.uniform1f(uChrom,  parseFloat(chromInp.worth));
  gl.uniform1f(uSpeed,  parseFloat(speedInp.worth));
  gl.uniform1f(uTime,   t);

  // replace the video texture (if energetic)
  if (videoReady) {
    gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, videoEl);
  }

  // render + subsequent body
  gl.drawArrays(gl.TRIANGLES, 0, 6);
  requestAnimationFrame(draw);
}

Challenges Alongside the Method

In fact, it wasn’t all easy crusing (pun meant).

At one level the wave went full chaos — spikes, sparkles, every part breaking up.

Seems, our smoothing logic was off by one pixel (actually).

One other humorous bug: when testing on high-refresh displays, the movement appeared too easy — prefer it misplaced its texture. So we had so as to add a contact of imperfection to convey again the “handmade” vibe.

Attempt It Your self

The entire setup is open and straightforward to remix — simply fork it and begin taking part in with the parameters.

Attempt altering:

  • the variety of factors
  • the easing curves
  • the colour gradients

We’d like to see what sort of waves you make — tag us or ship your remix!

Closing Ideas

Generally the most effective concepts come from not attempting too exhausting.

This one was speculated to be a fast inner experiment — nevertheless it changed into one thing oddly satisfying and visually wealthy.

We hope you take pleasure in it as a lot as we loved breaking (and fixing) it.

Made with ❤️ by Blacklead Studio as a part of our 12 Pens in 12 Months inventive problem.

Tags: DissectingRefractionSerendipityShaderSineWavy
Admin

Admin

Next Post
The Finest Offers Immediately: NBA 2K26, Logitech PC Gaming Equipment, and Extra

The Finest Offers Immediately: NBA 2K26, Logitech PC Gaming Equipment, and Extra

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recommended.

Web site Upkeep Providers within the USA

Web site Upkeep Providers within the USA

June 19, 2026
Threat Urge for food vs. Threat Tolerance: How are They Totally different?

Threat Urge for food vs. Threat Tolerance: How are They Totally different?

May 23, 2025

Trending.

HunyuanCustom Brings Single-Picture Video Deepfakes, With Audio and Lip Sync

HunyuanCustom Brings Single-Picture Video Deepfakes, With Audio and Lip Sync

May 8, 2025
AI & data-driven Starbucks – Deep Brew

AI & data-driven Starbucks – Deep Brew

May 18, 2026
A SQL MERGE assertion performs actions primarily based on a RIGHT JOIN

Use jOOQ’s code generator to simply go table-valued parameters

April 26, 2025
A SQL MERGE assertion performs actions primarily based on a RIGHT JOIN

With jOOQ – Java, SQL and jOOQ.

May 25, 2025
A SQL MERGE assertion performs actions primarily based on a RIGHT JOIN

Implicit path joins could now skip pointless tables within the be a part of tree

April 11, 2025

AimactGrow

Welcome to AimactGrow, your ultimate source for all things technology! Our mission is to provide insightful, up-to-date content on the latest advancements in technology, coding, gaming, digital marketing, SEO, cybersecurity, and artificial intelligence (AI).

Categories

  • AI
  • Coding
  • Cybersecurity
  • Digital marketing
  • Gaming
  • SEO
  • Technology

Recent News

The November 2026 search engine optimization Replace by Yoast recap • Yoast

The November 2026 search engine optimization Replace by Yoast recap • Yoast

November 26, 2026
Easy methods to get adrenaline in GTA 6

Easy methods to get adrenaline in GTA 6

November 25, 2026
  • About Us
  • Privacy Policy
  • Disclaimer
  • Contact Us

© 2025 https://blog.aimactgrow.com/ - All Rights Reserved

No Result
View All Result
  • Home
  • Technology
  • AI
  • SEO
  • Coding
  • Gaming
  • Cybersecurity
  • Digital marketing

© 2025 https://blog.aimactgrow.com/ - All Rights Reserved