tsParticles - v4.0.0-beta.12
    Preparing search index...

    Shape

    Controls the visual shape of particles. Supports built-in shapes, images, emoji, and custom registered shapes.

    Key Type Example Notes
    type string / array "circle" / ["circle", "star"] Shape type(s) to use; if array, one is picked randomly per particle
    options object Per-shape configuration — keys match shape type names
    Value Description Bundle required
    "circle" Filled circle @tsparticles/basic
    "edge" / "square" Square @tsparticles/slim
    "triangle" Triangle @tsparticles/slim
    "polygon" Regular polygon with N sides @tsparticles/slim
    "star" Star with N points @tsparticles/slim
    "line" Straight line @tsparticles/slim
    "image" / "images" External image or SVG @tsparticles/slim
    "character" / "char" Text / emoji character @tsparticles/slim
    {
    "shape": {
    "type": "circle"
    }
    }
    {
    "shape": {
    "type": ["circle", "triangle", "star"]
    }
    }
    {
    "shape": {
    "type": "polygon",
    "options": {
    "polygon": {
    "sides": 6
    }
    }
    }
    }
    {
    "shape": {
    "type": "star",
    "options": {
    "star": {
    "sides": 5,
    "inset": 2
    }
    }
    }
    }
    {
    "shape": {
    "type": "character",
    "options": {
    "character": {
    "value": ["❄️", "⛄", "🌨️"],
    "font": "Segoe UI Emoji",
    "style": "",
    "weight": "400"
    }
    }
    }
    }
    {
    "shape": {
    "type": "image",
    "options": {
    "image": {
    "src": "https://example.com/logo.png",
    "width": 32,
    "height": 32,
    "replaceColor": false
    }
    }
    }
    }

    Set replaceColor: true for SVG images to tint them with the particle color.

    tsParticles.addShape("myShape", drawer);
    
    {
    "shape": {
    "type": "myShape",
    "options": {
    "myShape": {
    "close": true,
    "fill": true
    }
    }
    }
    }

    All shape types accept these properties inside their options object:

    Key Type Notes
    fill boolean Fill the shape with color
    close boolean Close the shape path
    particles object Per-shape particle overrides (see IParticlesOptions)
    • Using "square" or "triangle" with @tsparticles/basic — these shapes require @tsparticles/slim or the dedicated shape package
    • Using "image" without providing width and height — the image may render at unexpected sizes
    • Using "character" with an emoji that relies on an external font without including that font in the page
    • Using replaceColor: true on raster images (PNG/JPG) — only works with SVG