Code based on Inigo Quilez approach:
It uses the same random calculations as the Unity standard Shader Graph Voronoi so both patterns can be overlapped.
| import 'dart:async'; | |
| import 'package:flutter/foundation.dart'; | |
| import 'package:flutter_riverpod/flutter_riverpod.dart'; | |
| import 'package:web_socket_channel/web_socket_channel.dart'; | |
| final _wsProvider = FutureProvider((ref) async { | |
| final ws = YourWebsocket(Uri(/** ... */)); | |
| ref.onDispose(ws.dispose); | |
| await ws.connect(); |
Code based on Inigo Quilez approach:
It uses the same random calculations as the Unity standard Shader Graph Voronoi so both patterns can be overlapped.
| float map(float value, float min1, float max1, float min2, float max2) { | |
| return min2 + (value - min1) * (max2 - min2) / (max1 - min1); | |
| } |