@@ -5,10 +5,11 @@ import 'package:flutter/material.dart';
5
5
import 'package:flutter/rendering.dart' ;
6
6
import 'package:vector_math/vector_math.dart' as v;
7
7
8
+ // Look Ma NO WIDGET in Flutter !!!
8
9
class Colored extends CustomPainter {
9
10
@override
10
11
void paint (Canvas canvas, Size size) {
11
- final simplex = v.SimplexNoise ();
12
+ final random = v.SimplexNoise ();
12
13
final frames = 200 ;
13
14
canvas.drawPaint (Paint ()..color = Colors .black87);
14
15
@@ -19,28 +20,40 @@ class Colored extends CustomPainter {
19
20
20
21
final area = Offset (i, i) & Size (i * 10 , i * 10 );
21
22
23
+ // Blue trail is made of rectangle
22
24
canvas.drawRect (
23
25
area,
24
26
Paint ()
25
- ..filterQuality = FilterQuality .high
26
- ..blendMode = BlendMode .screen
27
+ ..filterQuality =
28
+ FilterQuality .high // Change this to lower render time
29
+ ..blendMode =
30
+ BlendMode .screen // Remove this to see the natural drawing shape
27
31
..color =
32
+ // Addition of Opacity gives you the fading effect from dark to light
28
33
Colors .blue.withRed (i.toInt () * 20 % 11 ).withOpacity (i / 850 ));
29
- final int tailFibers = (i * 1 ).toInt ();
34
+
35
+ // Tail particles effect
36
+
37
+ // Change this to add more fibers
38
+ final int tailFibers = (i * 1.5 ).toInt ();
39
+
30
40
for (double d = 0 ; d < area.width; d += tailFibers) {
31
41
for (double e = 0 ; e < area.height; e += tailFibers) {
32
- final n = simplex .noise2D (d, e);
42
+ final n = random .noise2D (d, e);
33
43
final tail = exp (i / 50 ) - 5 ;
34
44
final tailWidth = .2 + (i * .11 * n);
35
45
canvas.drawCircle (
36
46
Offset (d, e),
37
47
tailWidth,
38
48
Paint ()
39
49
..color = Colors .red.withOpacity (.4 )
40
- ..isAntiAlias = true
50
+ ..isAntiAlias = true // Change this to lower render time
51
+ // Particles accelerate as they fall so we change the blur size for movement effect
41
52
..imageFilter = ImageFilter .blur (sigmaX: tail, sigmaY: 0 )
42
- ..filterQuality = FilterQuality .high
43
- ..blendMode = BlendMode .screen);
53
+ ..filterQuality =
54
+ FilterQuality .high // Change this to lower render time
55
+ ..blendMode = BlendMode
56
+ .screen); // Remove this to see the natural drawing shape
44
57
}
45
58
}
46
59
canvas.restore ();
0 commit comments