Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .fvmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"flutter": "3.35.0"
"flutter": "stable"
}
29 changes: 29 additions & 0 deletions assets/shaders/noise.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <flutter/runtime_effect.glsl>

out vec4 fragColor;

// Uniforms passed from Dart (Flutter automatically handles these in order)
uniform vec2 uSize; // Screen/widget resolution (equivalent to iResolution.xy)
uniform float scale; // Controls noise block size (original default: 1.0)
uniform float opacity; // Controls noise opacity (0.0 to 1.0)

// Hash function for noise generation
float hash(vec2 p) {
return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);
}

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
// Scale the coordinates
vec2 scaledCoord = floor(fragCoord / scale);

// Generate noise based on scaled coordinates
float noise = hash(scaledCoord);

// Output noise with premultiplied alpha for proper blending
// RGB is the noise value, alpha controls visibility
fragColor = vec4(vec3(noise) * opacity, opacity);
}

void main() {
mainImage(fragColor, FlutterFragCoord().xy);
}
1 change: 0 additions & 1 deletion example/lib/card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class BankCard extends StatelessWidget {
// stops: []
),
padding: EdgeInsets.symmetric(horizontal: 25.0, vertical: 25.0),
elevation: 5.0,
child: CardChild(),
),
),
Expand Down
Loading
Loading