use of com.almasb.fxgl.texture.Pixel in project FXGL by AlmasB.
the class ParticleDigitsSample method animateDigit.
private void animateDigit(int index) {
List<Pixel> pixels = sort(digits.get(index));
for (int i = 0; i < particles.size(); i++) {
var p = particles.get(i);
Pixel data = (i < pixels.size()) ? pixels.get(i) : pixels.get(pixels.size() - 1);
// drives the animation
animationBuilder().delay(Duration.seconds(i * 0.0001)).interpolator(Interpolators.SMOOTH.EASE_OUT()).translate(p).alongPath(new CubicCurve(p.getTranslateX(), p.getTranslateY(), getAppWidth() / 2.0, getAppHeight() / 2.0, getAppWidth() / 2.0, getAppHeight(), data.getX() + ANIMATION_OFFSET.getX(), data.getY() + ANIMATION_OFFSET.getY())).buildAndPlay();
}
}
Aggregations