mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-01 10:38:17 +08:00
docs: Deprecate TapDetector in favour of TapCallbacks (#2886)
Deprecate `TapDetector` in favour of `TapCallbacks`
This commit is contained in:
@ -1,10 +1,10 @@
|
||||
import 'package:examples/commons/ember.dart';
|
||||
import 'package:flame/components.dart';
|
||||
import 'package:flame/effects.dart';
|
||||
import 'package:flame/events.dart';
|
||||
import 'package:flame/game.dart';
|
||||
import 'package:flame/input.dart';
|
||||
|
||||
class OpacityEffectExample extends FlameGame with TapDetector {
|
||||
class OpacityEffectExample extends FlameGame with TapCallbacks {
|
||||
static const String description = '''
|
||||
In this example we show how the `OpacityEffect` can be used in two ways.
|
||||
The left Ember will constantly pulse in and out of opacity and the right
|
||||
@ -41,7 +41,7 @@ class OpacityEffectExample extends FlameGame with TapDetector {
|
||||
}
|
||||
|
||||
@override
|
||||
void onTap() {
|
||||
void onTapDown(_) {
|
||||
final opacity = sprite.paint.color.a;
|
||||
if (opacity >= 0.5) {
|
||||
sprite.add(OpacityEffect.fadeOut(EffectController(duration: 1)));
|
||||
|
||||
Reference in New Issue
Block a user