updateFlow method
void
updateFlow()
Implementation
void updateFlow() {
final delta = clock.getDelta();
final config = material?.uniforms[ 'config' ];
config['value'].x += flowSpeed * delta; // flowMapOffset0
config['value'].y = config['value'].x + halfCycle; // flowMapOffset1
// Important: The distance between offsets should be always the value of "halfCycle".
// Moreover, both offsets should be in the range of [ 0, cycle ].
// This approach ensures a smooth water flow and avoids "reset" effects.
if ( config['value'].x >= cycle ) {
config['value'].x = 0.0;
config['value'].y = halfCycle;
} else if ( config['value'].y >= cycle ) {
config['value'].y = config['value'].y - cycle;
}
}