Commit c9284dff authored by Viktor Lidholt's avatar Viktor Lidholt

Merge pull request #402 from vlidholt/master

Fixes anchor points for particles in particle systems
parents 18682227 f39dcbb4
...@@ -300,6 +300,10 @@ class ParticleSystem extends Node { ...@@ -300,6 +300,10 @@ class ParticleSystem extends Node {
_paint.setTransferMode(transferMode); _paint.setTransferMode(transferMode);
for (_Particle particle in _particles) { for (_Particle particle in _particles) {
// Rect
Rect rect = texture.frame;
rects.add(rect);
// Transform // Transform
double scos; double scos;
double ssin; double ssin;
...@@ -314,13 +318,13 @@ class ParticleSystem extends Node { ...@@ -314,13 +318,13 @@ class ParticleSystem extends Node {
scos = particle.size; scos = particle.size;
ssin = 0.0; 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); transforms.add(transform);
// Rect
Rect rect = texture.frame;
rects.add(rect);
// Color // Color
if (particle.simpleColorSequence != null) { if (particle.simpleColorSequence != null) {
Color particleColor = new Color.fromARGB( Color particleColor = new Color.fromARGB(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment