mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Fixes anchor points for particles in particle systems
This commit is contained in:
parent
7a386db1ee
commit
a27edc402c
@ -300,6 +300,10 @@ class ParticleSystem extends Node {
|
||||
_paint.setTransferMode(transferMode);
|
||||
|
||||
for (_Particle particle in _particles) {
|
||||
// Rect
|
||||
Rect rect = texture.frame;
|
||||
rects.add(rect);
|
||||
|
||||
// Transform
|
||||
double scos;
|
||||
double ssin;
|
||||
@ -314,13 +318,13 @@ class ParticleSystem extends Node {
|
||||
scos = particle.size;
|
||||
ssin = 0.0;
|
||||
}
|
||||
RSTransform transform = new RSTransform(scos, ssin, particle.pos[0], particle.pos[1]);
|
||||
double ax = rect.width / 2;
|
||||
double ay = rect.height / 2;
|
||||
double tx = particle.pos[0] + -scos * ax + ssin * ay;
|
||||
double ty = particle.pos[1] + -ssin * ax - scos * ay;
|
||||
RSTransform transform = new RSTransform(scos, ssin, tx, ty);
|
||||
transforms.add(transform);
|
||||
|
||||
// Rect
|
||||
Rect rect = texture.frame;
|
||||
rects.add(rect);
|
||||
|
||||
// Color
|
||||
if (particle.simpleColorSequence != null) {
|
||||
Color particleColor = new Color.fromARGB(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user