Fluent-Qt

Particles

ParticleBackdrop

Flowing ribbons, floating dots and a starfield with pointer ripples, theme-aware colors, and controls for motion and density.

Example

ParticleBackdrop: Flowing ribbons

Usage

Flowing ribbons

A quiet animated surface follows the current theme and motion preference.

#include <FluentQt/Particles.h>
using namespace fluent::particles;

auto* backdrop = new ParticleBackdrop(this);
backdrop->setEffect(ParticleBackdrop::FlowingRibbons);
backdrop->setBackgroundMode(ParticleBackdrop::Solid);
backdrop->setParticleCount(240);
backdrop->setMaximumFrameRate(30);
backdrop->setMinimumHeight(240);
backdrop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);

fluent::particles::ParticleBackdrop

Inherits QWidget · FluentElement · QMLPlus

Animated particle backdrop widget rendered on the CPU by default. Supports normal child layouts on top and pauses automatically when hidden or when reduced motion is enabled.

Constructors

Properties

Effect effect
Read effect()Write setEffect()Notify effectChanged()
bool animationEnabled
Read isAnimationEnabled()Write setAnimationEnabled()Notify animationEnabledChanged()
bool animating

Whether the particle animation is currently running.

Read isAnimating()Notify animatingChanged()
bool gpuAccelerationEnabled

Allows switching to GPU rendering when used with Spatial (default false; standalone widgets always use CPU).

Read isGpuAccelerationEnabled()Write setGpuAccelerationEnabled()Notify gpuAccelerationEnabledChanged()
qreal speed
Read speed()Write setSpeed()Notify speedChanged()
int particleCount
Read particleCount()Write setParticleCount()Notify particleCountChanged()
int maximumFrameRate
Read maximumFrameRate()Write setMaximumFrameRate()Notify maximumFrameRateChanged()
bool interactive
Read isInteractive()Write setInteractive()Notify interactiveChanged()
bool pauseWhenInactive
Read isPauseWhenInactive()Write setPauseWhenInactive()Notify pauseWhenInactiveChanged()
BackgroundMode backgroundMode
Read backgroundMode()Write setBackgroundMode()Notify backgroundModeChanged()
QMarginsF fadeMargins
Read fadeMargins()Write setFadeMargins()Notify fadeMarginsChanged()

Methods

void setEffect(Effect effect)

Switches the particle preset and resets simulation phase without resuming paused motion.

bool isAnimating() const

Whether the particle animation is currently running.

bool isGpuAccelerationEnabled() const

Allows switching to GPU rendering when used with Spatial (default false; standalone widgets always use CPU).

void setGpuAccelerationEnabled(bool enabled)

Allows switching to GPU rendering when used with Spatial (default false; standalone widgets always use CPU).

void setSpeed(qreal speed)

Sets simulation speed multiplier in [0, 4]; 0 pauses motion.

void setParticleCount(int count)

Sets particle count in [0, 960] (excluding FlowingRibbons ribbons and sparks).

void setMaximumFrameRate(int framesPerSecond)

Sets maximum animation frame rate in [1, 60] fps.

void setPauseWhenInactive(bool pause)

Whether to pause animation when the application becomes inactive.

void setFadeMargins(const QMarginsF& margins)

Sets non-negative edge fade widths in logical pixels.

void triggerRipple(const QPointF& position)

Emits a decorative ripple at local coordinates when motion is allowed (up to 3 active).

Signals

void animatingChanged(bool animating)

Whether the particle animation is currently running.

void gpuAccelerationEnabledChanged(bool enabled)

Allows switching to GPU rendering when used with Spatial (default false; standalone widgets always use CPU).

Enumerations

enum Effect

Built-in particle presets.

  • FlowingRibbons Orbiting ribbons and sparks.
  • FloatingDots Soft lights drifting upward.
  • Starfield Stars moving toward the viewer.
enum BackgroundMode

Background fill mode.

  • Transparent
  • Solid

Destructors

Protected members

Methods

Inherited from fluent::FluentElement

Methods

static void setTheme(Theme theme)

Updates the global theme and notifies active FluentElement instances.

static void setThemeDeferred(Theme theme)

Schedules a visible-first batched theme refresh without blocking the current interaction.

static Theme currentTheme()

Returns the currently active global theme.

static bool themeUsesDarkAppearance(Theme theme)

Returns whether a theme uses dark-backed chrome and material tokens.

static void refreshTheme()

Re-broadcasts the current theme to repaint after a design-token change.

static int themeGeneration()

Monotonic counter bumped on every theme change, for staleness checks.

Theme effectiveTheme() const

Resolves the theme used by this element, honoring an inherited QWidget override.

bool effectiveThemeUsesDarkAppearance() const

Returns whether this element's effective theme uses dark-backed chrome.

bool setThemeOverrides(const QJsonObject& overrides)

Replaces this element's sparse color, radius, and font token overrides.

QJsonObject themeOverrides() const

Returns this element's authored overrides.

void clearThemeOverrides()

Restores all token fields to global theme defaults.

const Colors& themeColorsRef() const

Non-copying access to the active color set for hot paint paths.

Material::AcrylicToken themeAcrylic() const

Material, elevation, and adaptive layout tokens.

QColor themeBackdrop(bool active) const

Window-chrome backdrop color for the given activation state.

virtual void onThemeUpdated()

Called after the global theme changes.

Enumerations

enum Theme

Global visual theme used when resolving design tokens.

  • Light = 0
  • Dark = 1
  • HighContrast = 2

Types and aliases

struct Colors

Design token snapshots returned to components.

Inherited from fluent::QMLPlus

Methods

AnchorLayout::Anchors* anchors()

Returns mutable anchors for the QWidget host.

void setState(const QString& name)

Applies a registered state by name, or restores the default state when @p name is empty. Unknown names are ignored, and existing bindings resume when leaving the state.

void addState(const QMLState& state)

Registers or replaces a named state definition; replacing the active state applies it immediately.

void evaluateStates()

Reevaluates state conditions in registration order and activates the first match, or the default state if none match. Also runs automatically when dependency properties notify; derived states using extend inherit ancestor changes unless cyclic or missing.

QMLPlusRuntime* runtime()

Returns the lazily created state observer owned by this host.

void setAnchors(const AnchorLayout::Anchors& anchors)

Replaces all host anchors and invalidates the parent layout.

void resetAnchors()

Clears all host anchors and invalidates the parent layout.

void bind(const char* targetProp, QObject* source, const char* sourceProp, PropertyBinder::Direction dir = PropertyBinder::OneWay)

Binds @p sourceProp on @p source to @p targetProp on this QWidget host via PropertyBinder::bind().

void addTransition(const StateTransition& transition)

Registers a state transition in precedence order.

void setBehavior(const char* propertyName, const PropertyAnimation& animation)

Sets the default animation used when @p propertyName is written via writeProperty() or a binding. Explicit StateTransition rules take precedence; direct C++ setter calls are not animated.

void clearBehavior(const char* propertyName)

Removes the default animation for future managed writes.

bool writeProperty(const char* propertyName, const QVariant& value)

Writes a host property through Behavior without removing its binding.

Qt base class docs: QWidget