Bouncing-o1o

//laudergroupresources.com/

				
					import javax.swing.*;
import java.awt.*;
import java.util.Random;

public class BinaryMatrixEffect extends JPanel {

    private final int width = 800;
    private final int height = 600;
    private final int fontSize = 18;
    private final int columns;
    private final int[] drops;

    public BinaryMatrixEffect() {
        this.setPreferredSize(new Dimension(width, height));
        columns = width / fontSize;
        drops = new int[columns];
        for (int i = 0; i < columns; i++) {
            drops[i] = 1;
        }

        Timer timer = new Timer(50, e -> repaint());
        timer.start();
    }

    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);

        // Cast Graphics to 2D
        Graphics2D g2d = (Graphics2D) g;

        // Semi-transparent black background
        g2d.setColor(new Color(0, 0, 0, 150));
        g2d.fillRect(0, 0, width, height);

        g2d.setColor(Color.GREEN);
        g2d.setFont(new Font("Monospaced", Font.PLAIN, fontSize));
        Random rand = new Random();

        // Draw binary rain
        for (int i = 0; i < columns; i++) {
            String binaryChar = rand.nextBoolean() ? "0" : "1";

            int x = i * fontSize;
            int y = drops[i] * fontSize;

            // Optional: shape logic to mask a figure
            if (!isInSilhouette(x, y)) {
                g2d.drawString(binaryChar, x, y);
            }

            // Random reset
            if (y > height && rand.nextInt(100) > 95) {
                drops[i] = 0;
            }

            drops[i]++;
        }
    }

    // Fake silhouette mask (returns true if inside a hooded figure shape)
    private boolean isInSilhouette(int x, int y) {
        int centerX = width / 2;
        int centerY = height / 2;
        int radius = 120;

        // Crude circle head and shoulders
        double dist = Math.sqrt(Math.pow(x - centerX, 2) + Math.pow(y - centerY, 2));
        return dist < radius || (y > centerY && Math.abs(x - centerX) < radius * 1.5);
    }

    public static void main(String[] args) {
        JFrame frame = new JFrame("Binary Matrix Effect");
        BinaryMatrixEffect panel = new BinaryMatrixEffect();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.add(panel);
        frame.pack();
        frame.setVisible(true);
    }
}
				
			
Scroll to Top