mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-03 04:18:25 +08:00
fix: doc/examples/particles, added web to .gitignore feat: doc/examples/particles, added more examples, refactor: Particle does not extend Component refactor: Particle subclasses in separate folder refactor: ParticleComponent is now simple container fix: SingleChildParticle, asserts for child existing feat: AnimationParticle for Flame Animation feat: ComponentParticle for Flame Component feat: SpriteParticle for Flame Sprite
35 lines
672 B
Dart
35 lines
672 B
Dart
import 'dart:ui';
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
import '../particle.dart';
|
|
import '../position.dart';
|
|
import '../components/component.dart';
|
|
|
|
class ComponentParticle extends Particle {
|
|
final Component component;
|
|
final Position size;
|
|
final Paint overridePaint;
|
|
|
|
ComponentParticle({
|
|
@required this.component,
|
|
this.size,
|
|
this.overridePaint,
|
|
double lifespan,
|
|
Duration duration,
|
|
}) : super(
|
|
lifespan: lifespan,
|
|
duration: duration,
|
|
);
|
|
|
|
@override
|
|
void render(Canvas canvas) {
|
|
component.render(canvas);
|
|
}
|
|
|
|
@override
|
|
void update(double dt) {
|
|
super.update(dt);
|
|
component.update(dt);
|
|
}
|
|
} |