Skip to content

Conversation

Bala050814
Copy link

This example demonstrates a fundamental technique for creating a fading visual trail behind a moving object (the mouse cursor) by tracking and managing a fixed-size array of historical positions.

It effectively shows how to implement a basic fixed-length queue (or buffer) to store time-series data, and then visually render that history with progressive fading and size reduction.

Technical Details
Category: shapes

Complexity: [★☆☆☆] 1/4 (Very Simple)

Focus: Core game loop pattern for storing object history.

Key Functions Demonstrated:

GetMousePosition()

Array Shifting: Logic to drop the oldest position and insert the newest.

DrawCircleV() with Fade(): Applying index-based color and size changes to visualize age.

Uniqueness: This example is unique as no existing raylib example is dedicated solely to illustrating this specific "history/trail" visual effect.

@raysan5 raysan5 changed the title feat(shapes): Add shapes_mouse_trail.c example and screenshot [examples] Added shapes_mouse_trail Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant