Skip to content

Effects

Effects settings manage animation effects for the site. Currently supports sakura effect.

Sakura Effect

The sakura effect adds falling cherry blossom animation to your site.

Config File

src/config/effectsConfig.ts

Basic Configuration

PropertyTypeDefaultDescription
enablebooleanfalseEnable sakura effect
switchablebooleanfalseAllow users to toggle in settings panel
sakuraNumnumber21Number of sakura petals
limitTimesnumber-1Out-of-bounds limit, -1 for infinite
zIndexnumber100Z-index layer

Size

PropertyTypeDefaultDescription
size.minnumber0.5Minimum size multiplier
size.maxnumber1.1Maximum size multiplier

Opacity

PropertyTypeDefaultDescription
opacity.minnumber0.3Minimum opacity
opacity.maxnumber0.9Maximum opacity

Speed

PropertyTypeDefaultDescription
speed.horizontal.minnumber-1.7Min horizontal speed
speed.horizontal.maxnumber-1.2Max horizontal speed
speed.vertical.minnumber1.5Min vertical speed
speed.vertical.maxnumber2.2Max vertical speed
speed.rotationnumber0.03Rotation speed
speed.fadeSpeednumber0.03Fade speed

WARNING

fadeSpeed should not exceed opacity.min, otherwise petals may disappear instantly.

Full Example

ts
export const sakuraConfig: SakuraConfig = {
  enable: true,
  switchable: true,
  sakuraNum: 21,
  limitTimes: -1,
  size: { min: 0.5, max: 1.1 },
  opacity: { min: 0.3, max: 0.9 },
  speed: {
    horizontal: { min: -1.7, max: -1.2 },
    vertical: { min: 1.5, max: 2.2 },
    rotation: 0.03,
    fadeSpeed: 0.03,
  },
  zIndex: 100,
};