mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-03 04:18:25 +08:00
feat: docs, adde particles docs
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
This commit is contained in:
35
lib/particles/component_particle.dart
Normal file
35
lib/particles/component_particle.dart
Normal file
@ -0,0 +1,35 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user