54 float baseSize = params.radius * 0.08f;
55 float maxParticleSize = baseSize * 2f;
57 float fullArea = (float) (Math.PI * params.radius * params.radius);
58 float particleArea = (float) (Math.PI * baseSize * baseSize);
60 int count = (int) Math.round(fullArea / particleArea * 1f);
62 if (count > 300) count = 300;
67 float maxSpeed = params.radius * 2f;
69 Color negativeColor =
new Color(0, 0, 0, 255);
72 for (
int i = 0; i < count; i++) {
73 float size = baseSize * (1f + (float) Math.random());
75 Color randomColor =
new Color(Misc.random.nextInt(256),
76 Misc.random.nextInt(256), Misc.random.nextInt(256), params.color.getAlpha());
77 Color adjustedColor = Misc.interpolateColor(params.color, randomColor, 0.2f);
78 adjustedColor = params.color;
83 float r = (float) Math.random();
84 float dist = params.radius * 0.2f * (0.1f + r * 0.9f);
85 float dir = (float) Math.random() * 360f;
87 Vector2f offset = Misc.getUnitVectorAtDegreeAngle(dir);
98 Vector2f loc = Vector2f.add(params.loc, offset,
new Vector2f());
100 float speed = maxSpeed * (0.25f + 0.75f * (float) Math.random());
101 Vector2f vel = Misc.getUnitVectorAtDegreeAngle(dir);
113 engine.addNebulaParticle(loc, vel, size, 3f, rampUp, 0f, dur, adjustedColor);