Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Snippet] Marching Ants

Featured Replies

b9696f04c71b846b7d7d1c088d7b50da.gif

 

Class:

package temp;

import java.awt.BasicStroke;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Observable;

import javax.swing.Timer;

public class MarchingAnts extends Observable {

	private BasicStroke stroke;

	private float dashPhase = 0f;
	private float dash[] = {5.0f,5.0f};

	private ActionListener listener = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent ae) {
			dashPhase += 9.0f;
			stroke = new BasicStroke(1.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 1.5f,  dash, dashPhase);
			setChanged();
			notifyObservers();
		}
	};

	public MarchingAnts() {
		stroke = new BasicStroke(1.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 1.5f,  dash, dashPhase);
	}

	private Timer timer = new Timer(40, listener);

	public BasicStroke getStroke() {
		return stroke;
	}

	public void startAnimation() {
		timer.start();
	}

	public void stopAnimation() {
		timer.stop();
	}

}

Example:

//Declare
private MarchingAnts ants = new MarchingAnts();

...

//Start animation
ants.startAnimation();

...

//Add observers
ants.addObserver((obj, obs) -> repaint()); //repaint() method from a painting component

...

//Use stroke
g2d.setStroke(ants.getStroke());

Edited by Botre

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.