Without further ado, I will just post the java code for you.
import java.awt.Color; import java.awt.Graphics; import java.awt.image.BufferedImage; import javax.swing.JFrame; import javax.swing.JPanel; public class MeteorFly extends JFrame { final int MAX = ; // (~)The number of meteors final int SLEEP = ; // The speed of meteor flight (the larger the value, the slower the speed) final int COLORLV = ; // (~) Color scale (can change the halo size) final String COLOR = null; // ("#"~"#ffffff") Halo color (if not filled in or null, it is the default color) final int SIZE = ; // (~) Meteor size private MyPanel panel; public MeteorFly() { panel = new MyPanel(); this.getContentPane().add(panel); this.setSize(, ); // Create a form this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true); } public static void main(String[] args) { new MeteorFly(); } class MyPanel extends JPanel implements Runnable { Meteor p[]; int AppletWidth, AppletHeight; BufferedImage OffScreen; Graphics drawOffScreen; Thread pThread; public MyPanel() { setBackground(Color.black); //Form initialization AppletWidth = ; AppletHeight = ; p = new Meteor[MAX]; for (int i = ; i < MAX; i++) p[ i] = new Meteor(); OffScreen = new BufferedImage(AppletWidth, AppletHeight, BufferedImage.TYPE_INT_BGR); drawOffScreen = OffScreen.getGraphics(); pThread = new Thread(this); pThread.start(); } @Override public void paintComponent(Graphics g) { // TODO Auto-generated method stub super.paintComponents( g); g.drawImage(OffScreen, , , this); } @Override final public void run() { while (true) { // drawOffScreen.clearRect(, , AppletWidth, AppletHeight); // // Clear the screen for (int i = ; i < MAX; i++) { drawOffScreen.setColor(p[i]. color); // RGB color drawOffScreen.fillOval(p[i].x, p[i].y, SIZE, SIZE); p[i].x += p[i].mx; p[i].y += p[i].my; // if (p[i].x > AppletWidth || p[i].y > AppletHeight) { // p[i].reset(); // } int x = p[i].x; int y = p[i].y; int R = p[i].color.getRed( ); // Extract color int G = p[i].color.getGreen(); int B = p[i].color.getBlue(); while (true) { if (R == && G == && B == ) { break; } R -= COLORLV; // Fade tail color if (R < ) { R = ; } G -= COLORLV; if (G < ) { G = ; } B -= COLORLV; if (B < ) { B = ; } Color color = new Color(R, G, B); x -= p[i].mx; // Cover the tail y -= p[i].my; drawOffScreen.setColor(color); drawOffScreen .fillOval(x, y, SIZE, SIZE); } if (x > AppletWidth || y > AppletHeight) { // The meteor flies out of the window, reset the meteor p[i].reset(); } } repaint(); try { Thread.sleep(SLEEP); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace (); } } } } class Meteor { // Meteor class int x, y; // Meteor position int mx, my; // Falling speed Color color; // Meteor color public Meteor() { reset(); } public void reset() { int rand = (int) (Math.random() * ); // Randomly generate meteor location if (rand > ) { x = (int) (Math.random() * ); y = ; } else { y = (int) (Math.random() * ); x = ; } mx = (int) (Math.random() * + ); //Randomly generate falling speed and angle my = (int) (Math.random() * + ); if (COLOR == null || COLOR.length() == ) { color = new Color( // Random color (new Double(Math.random() * )).intValue() + , (new Double(Math.random() * )).intValue() + , (new Double(Math.random() * )).intValue() + ); } else { color = Color.decode(COLOR); } } } }The above code is the pure Java code that this article tells you to implement meteors across the sky. I hope that sharing this article can bring you unexpected gains.