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.

Rotating Cursor With Fading Mouse Trail

Featured Replies

I have a lot of people ask me what the code is for my mouse cursor, so I mine as well post this.

 

MousePathPoint class:

import java.awt.Point;

//CREDITS TO ENFILADE

class MousePathPoint extends Point {

	private long finishTime;
	private double lastingTime;
	private int alpha = 255;

	public MousePathPoint(int x, int y, int lastingTime) {
		super(x, y);
		this.lastingTime = lastingTime;
		finishTime = System.currentTimeMillis() + lastingTime;
	}

        //added by Swizzbeat
	public int getAlpha() {
		int newAlpha = ((int) ((finishTime - System.currentTimeMillis()) / (lastingTime / alpha)));
		if (newAlpha > 255)
			newAlpha = 255;
		if (newAlpha < 0)
			newAlpha = 0;
		return newAlpha;
	}

	public boolean isUp() {
		return System.currentTimeMillis() >= finishTime;
	}

}

Class variables in main class:

private int mX, mY;
private long angle;
private BasicStroke cursorStroke = new BasicStroke(2);
private Color cursorColor = Color.WHITE;
private AffineTransform oldTransform;

Code to put in your onPaint:

Graphics2D g = (Graphics2D) g1;    //replace g1 with Graphics variable name
oldTransform = g.getTransform();
mX = client.getMousePosition().x;
mY = client.getMousePosition().y;

g.setRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON));

//MOUSE TRAIL
while (!mousePath.isEmpty() && mousePath.peek().isUp())
	mousePath.remove();
Point clientCursor = client.getMousePosition();
MousePathPoint mpp = new MousePathPoint(clientCursor.x, clientCursor.y, 300);
if (mousePath.isEmpty() || !mousePath.getLast().equals(mpp))
	mousePath.add(mpp);
MousePathPoint lastPoint = null;
for (MousePathPoint a : mousePath) {
	if (lastPoint != null) {
		g.setColor(new Color(255, 255, 255, a.getAlpha()));    //trail color
		g.drawLine(a.x, a.y, lastPoint.x, lastPoint.y);
	}
	lastPoint = a;
		}

if (mX != -1) {
	g.setStroke(cursorStroke);
	g.setColor(cursorColor);
	g.drawLine(mX-3, mY-3, mX+2, mY+2);
	g.drawLine(mX-3, mY+2, mX+2, mY-3);

	g.rotate(Math.toRadians(angle+=6), mX, mY);

	g.draw(new Arc2D.Double(mX-12, mY-12, 24, 24, 330, 60, Arc2D.OPEN));
	g.draw(new Arc2D.Double(mX-12, mY-12, 24, 24, 151, 60, Arc2D.OPEN));

        g.setTransform(oldTransform);
}
  • 2 weeks later...

MousePath cannot be resolved?
?

 

You obviously have to create a mousePath object....

List<MousePathPoint> mousePath = new LinkedList<>();

:troll:

k ;p

Guest
This topic is now closed to further replies.

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.