Skip to content

RGB Script to create a real time clock effect. - #2038

Open
MDAR wants to merge 5 commits into
mcallegari:masterfrom
MDAR:master
Open

RGB Script to create a real time clock effect.#2038
MDAR wants to merge 5 commits into
mcallegari:masterfrom
MDAR:master

Conversation

@MDAR

@MDAR MDAR commented May 31, 2026

Copy link
Copy Markdown

This is a very simple Clock script.

Designed by Stuart Hanlon but code created by Claude.ai

The premise is that the script creates dots or percentage areas relevant to real time.

  • 24 hour
  • 12 hour
  • Minutes
  • Seconds

From real time of the host machine.

There's a progress bar option, which fills from the start to a percentage of the space.

Checklist
I have read and followed the QLC+ Coding Guidelines.
My code adheres to the project's coding style, including:
Placing opening braces { on a new line for functions and class definitions.
Consistent use of spaces and indentation.
I have tested my changes on the following platforms:
Linux yes
Windows
macOS ( intel and amd64 )
I have added or updated documentation as necessary.

MDAR added 5 commits May 31, 2026 23:07
This is a very simple Clock script. 

Designed by Stuart Hanlon but code created by Claude.ai


The premise is that the script creates
* 24 hour
* 12 hour
* Minutes
* Seconds

From real time
# levelGauge.js

A QLC+ RGB Script that displays an external level value as a visual fill indicator across an LED matrix.

## Use Case

Designed for venues that receive a live level value via Virtual Console slider, ArtNet, sACN, OSC or other input.

The incoming value (0–255) maps directly to the QLC+ RGB Matrix step, driving the fill level in real time with no conversion required.

## Display Modes

| Mode | Description |
|---|---|
| Bar Horizontal | Fills left to right |
| Bar Vertical | Fills bottom to top |
| Bar Horizontal Rev | Fills right to left |
| Bar Vertical Rev | Fills top to bottom |
| Bar Split | Fills from centre outward in both directions |
| Radial | Pie sweep, clockwise from 12 o'clock |
| Radial Expand | Filled circle expanding outward from centre |

## Properties

| Property | Description |
|---|---|
| Display Mode | Selects the fill style from the modes above |

## Colours

Supports two colours (`acceptColors = 2`):

- **Colour 1** — fill colour (the active level)
- **Colour 2** — background colour (the unfilled portion)

Set Colour 2 to black to leave unfilled pixels dark.

## DMX Mapping

| DMX Value | Level |
|---|---|
| 255 | Full (100%) |
| 128 | Half (50%) |
| 0 | Empty (0%) |

`rgbMapStepCount` returns 256, giving a direct 1:1 relationship between the incoming ArtNet/sACN DMX value and the displayed fill level.

## Matrix Size

Works with any matrix size or aspect ratio.
Bar modes suit rectangular layouts; 
Radial modes suit square or near-square matrices.

## Author

Stuart Hanlon — MDAR Limited (mdar.co.uk)
Created by Claude AI (Anthropic)
# clockHands.js

A QLC+ RGB Script that renders analogue clock hands on a square or near-square LED matrix.

## Use Case

Designed for LED panels or matrices where an analogue clock face is required as an ambient or decorative effect. Both hands move smoothly and continuously in real time, derived from `new Date()` on every frame.

Supports use as a **mask layer** in a QLC+ Collection — disabling either hand causes those pixels to output black, revealing any underlying RGB effect through the unlit areas.

## Hand Styles

| Style | Description |
|---|---|
| Arrow | Tapers to a point at the tip — classic clock hand |
| Paddle | Constant width along the full length — bold rectangular blade |
| Lollipop | Thin shaft with a circular bulb at the tip |
| Skeleton | Hollow outlined blade, lit only at the edges — luxury watch style |
| Breguet | Tapered shaft with an elliptical cutout near the tip — antique pocket watch inspired |

## Properties

| Property | Values | Description |
|---|---|---|
| Show Hour Hand | Yes, No | Enable or disable the hour hand |
| Show Minute Hand | Yes, No | Enable or disable the minute hand |
| Hand Style | Arrow, Paddle, Lollipop, Skeleton, Breguet | Visual style applied to both hands |
| Hand Width % | 1–20 | Blade width as a percentage of radius |
| Hour Length % | 20–90 | Hour hand length as a percentage of radius |
| Minute Length % | 20–100 | Minute hand length as a percentage of radius |
| Centre Gap % | 0–30 | Blank hub radius at centre as a percentage of radius |

## Colours

Supports two colours (`acceptColors = 2`):

- **Colour 1** — minute hand colour
- **Colour 2** — hour hand colour

## Clock Behaviour

- The **hour hand** moves smoothly between hour positions, tracking the current minute
- The **minute hand** moves smoothly between minute positions, tracking the current second
- Both hands always reflect real time — they do not follow the QLC+ step counter

## Masking

Setting either hand to **No** causes those pixels to output black (0,0,0). When layered over another RGB Matrix function in a QLC+ Collection, the underlying effect will show through wherever the disabled hand would have appeared.

## Matrix Size

Best results on a **square or near-square** matrix. The clock face is inscribed within the smallest dimension of the matrix. Rectangular matrices will produce an oval clock face.

## Notes

- The Centre Gap % property removes pixels near the centre pivot point, which avoids visual clutter where both hands overlap.
- The Breguet and Skeleton styles are most effective at larger matrix sizes where there are sufficient pixels to render the detail.
- In the QLC+ RGB Script devtool, the second colour (hour hand) will not preview correctly as the devtool passes the step value in place of `rgb2`. Both colours will work correctly inside QLC+.

## Author

Stuart Hanlon — MDAR Limited (mdar.co.uk)
Created by Claude AI (Anthropic)
# clockSimple.js

A QLC+ RGB Script that displays the current real time as a single pixel, dot, or progress bar across an LED matrix.

## Use Case

Designed for LED strips or matrices where the current time should be indicated as a visual marker — for example, an LED strip around a mirror showing the current hour, minute, or second position.

Time is fetched live via `new Date()` on every frame, ensuring the display is always accurate regardless of the QLC+ step counter.

## Display Modes

| Mode | Description |
|---|---|
| Dot | A band of pixels travels across the matrix, centred on the current time position |
| Progress | Pixels fill from the start up to the current time position (progress bar style) |

## Properties

| Property | Values | Description |
|---|---|---|
| Orientation | Horizontal, Vertical | Direction of travel across the matrix |
| Time Unit | Hour, Minute, Second | Which part of the current time to display |
| Hour Format | 12h, 24h | 12-hour (0–11) or 24-hour (0–23) for Hour mode |
| Display Mode | Dot, Progress | Visual style |
| Dot Width % | 1–50 | Width of the dot as a percentage of the matrix dimension |

## Colours

Supports one colour (`acceptColors = 1`). The single selected colour is applied to all lit pixels.

## Time Mapping

| Time Unit | Range | Matrix requirement |
|---|---|---|
| Hour (12h) | 0–11 | At least 12 pixels wide/tall |
| Hour (24h) | 0–23 | At least 24 pixels wide/tall |
| Minute | 0–59 | At least 60 pixels wide/tall |
| Second | 0–59 | At least 60 pixels wide/tall |

The time value is scaled proportionally across the full matrix dimension, so any pixel count works correctly.

## Matrix Size

Works with any matrix size. The time position always scales proportionally — a 186-pixel strip will place the marker at the correct proportional position for any time value.

## Recommended QLC+ Update Intervals

| Time Unit | Suggested interval |
|---|---|
| Second | 250ms |
| Minute | 750ms |
| Hour | 5 minutes |

## Notes

- The Dot Width % property only applies in Dot mode and has no effect in Progress mode.
- Multiple instances of this script can be run simultaneously — one per time unit — each assigned to a separate RGB Matrix function.

## Author

Stuart Hanlon — MDAR Limited (mdar.co.uk)
Created by Claude AI (Anthropic)
Whole solution doesn't work

There is no way to affect the Step position from the UI

This needs a re-think to get the Step / position information from a WebSocket or API variable
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