feat: Introduce flame_noise, deprecate NoiseEffectController (#2393)

This:

* Deprecates the NoiseEffectController that is based on the deprecated
vector_math library impl
* Adds a new bridge package `flame_noise` to bridge fast noise

Note: the *goal* of this PR is to allow the immediate deprecation of the
old NoiseEffectController by providing an experimental, suitable
replacement. I believe the package flame_noise will look nothing like
this at all if I am able to land [some improvements to the underlying
fast_noise lib](https://github.com/frankpepermans/fast_noise/pull/5). We
will be able to have for example a generic NoiseEffectController.

However I believe we should merge this as an experimental package for
now to unblock removing the current implementation from Flame which is
negatively affecting our scores on pub. Therefore I would advise we
don't spend any time discussing specifics of how the API/impl provided
for the flame_noise, and just go with _something_ instead of nothing.
This commit is contained in:
Luan Nico
2023-03-14 20:59:21 -04:00
committed by GitHub
parent 426b312402
commit b2fdf06a79
13 changed files with 174 additions and 5 deletions

View File

@ -3,6 +3,7 @@ import 'dart:math';
import 'package:flame/effects.dart';
import 'package:flame/game.dart';
import 'package:flame/geometry.dart';
import 'package:flame_noise/flame_noise.dart';
import 'package:flutter/material.dart';
class MoveEffectExample extends FlameGame {
@ -96,12 +97,12 @@ class MoveEffectExample extends FlameGame {
[
MoveEffect.by(
Vector2(5, 0),
NoiseEffectController(duration: 1, frequency: 20),
PerlinNoiseEffectController(duration: 1, frequency: 20),
),
MoveEffect.by(Vector2.zero(), LinearEffectController(2)),
MoveEffect.by(
Vector2(0, 10),
NoiseEffectController(duration: 1, frequency: 10),
PerlinNoiseEffectController(duration: 1, frequency: 10),
),
],
infinite: true,