This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ShaderHomePage extends StatefulWidget { | |
const ShaderHomePage({super.key}); | |
@override | |
State<ShaderHomePage> createState() => _ShaderHomePageState(); | |
} | |
class _ShaderHomePageState extends State<ShaderHomePage> { | |
late Timer timer; | |
double delta = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ShaderPainter extends CustomPainter { | |
final FragmentShader shader; | |
final double time; | |
ShaderPainter(FragmentShader fragmentShader, this.time) | |
: shader = fragmentShader; | |
@override | |
void paint(Canvas canvas, Size size) { | |
final paint = Paint(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <flutter/runtime_effect.glsl> | |
uniform vec2 uSize; | |
uniform float iTime; | |
vec2 iResolution; | |
out vec4 fragColor; | |
#define PI 3.1415926535897932384626433832795 | |
void main(void) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <flutter/runtime_effect.glsl> | |
uniform vec2 uSize; | |
uniform float iTime; | |
vec2 iResolution; | |
out vec4 fragColor; | |
#define PI 3.1415926535897932384626433832795 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define PI 3.1415926535897932384626433832795 | |
void mainImage( out vec4 fragColor, in vec2 fragCoord ) | |
{ | |
vec2 center = fragCoord/iResolution.xy - vec2(0.5, 0.5); | |
float dist = length(center); | |
float p = (atan(center.y,center.x)) / (2.0 * PI); | |
float numStripes = 12.0; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyPainter extends CustomPainter { | |
final Paint paint; | |
MyPainter(this.paint); | |
@override | |
void paint(Canvas canvas, Size size) { | |
canvas.drawRect( | |
Rect.fromLTRB(0, 0, size.width, size.height), | |
paint, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CustomPaint( | |
painter: MyPainter(paint), | |
child: Container(), | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Paint paint = Paint() | |
..shader = Shader.linearGradient( | |
colors: [Colors.red, Colors.blue], | |
begin: Alignment.topLeft, | |
end: Alignment.bottomRight, | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return Scaffold( | |
appBar: AppBar( | |
title: Text(widget.title), | |
), | |
body: CustomScrollView( | |
slivers: [ | |
SliverList(delegate: SliverChildBuilderDelegate( | |
(context, index) { | |
return Text("hello user"); | |
}, |