Skip to content

Commit bba038b

Browse files
committed
fix incorrect color scale
1 parent 3b927ef commit bba038b

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ var defaultRampColors = {
1515
0.2: '#abdda4',
1616
0.3: '#e6f598',
1717
0.4: '#fee08b',
18-
0.6: '#fdae61',
19-
0.9: '#f46d43',
18+
0.5: '#fdae61',
19+
0.6: '#f46d43',
2020
1.0: '#d53e4f'
2121
};
2222

@@ -61,7 +61,7 @@ export function init(gl, windData, windImage, particleStateTextureSize) {
6161
util.bindFramebuffer(gl, framebuffer, screenTexture);
6262
gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);
6363

64-
drawTexture(backgroundTexture, 0.996);
64+
drawTexture(backgroundTexture, 0.999);
6565
drawParticles();
6666

6767
util.bindFramebuffer(gl, null);

src/shaders/draw.frag.glsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ void main() {
1111
vec2 velocity = u_wind_min + (u_wind_max - u_wind_min) * texture2D(u_wind, v_particle_pos).rg;
1212
float speed_t = length(velocity) / length(u_wind_max);
1313

14-
float x = mod(512.0 * speed_t, 16.0) / 16.0;
15-
float y = floor(512.0 * speed_t / 16.0) / 16.0;
14+
float x = fract(16.0 * speed_t);
15+
float y = floor(16.0 * speed_t) / 16.0;
1616

1717
gl_FragColor = texture2D(u_color_ramp, vec2(x, y));
1818
}

src/shaders/update.frag.glsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void main() {
4141
vec2 seed = (particle_pos + v_position) * u_rand_seed;
4242

4343
particle_pos = rand(seed) < 0.997 - speed_t * 0.01
44-
? mod(1.0 + particle_pos + vec2(dx, dy) * 0.00002, 1.0)
44+
? fract(1.0 + particle_pos + vec2(dx, dy) * 0.00002)
4545
: vec2(rand(seed + 1.3), rand(seed + 2.1));
4646

4747
gl_FragColor = vec4(encode(particle_pos.x), encode(particle_pos.y));

0 commit comments

Comments
 (0)