> ## Documentation Index
> Fetch the complete documentation index at: https://rive.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# PathEffect

A scripted effect applied to a path
For effects that can change over time, even
when the path does not change, markNeedsAdvance()
should be called on its context in the advance function

For more information, see [Path Effect Scripts](scripting/protocols/path-effect-scripts).

## Methods

### `init`

<div class="signature">
  ```lua theme={null}
  init(self: T, context: Context) -> boolean
  ```
</div>

Called once when the effect is created or attached.
Return `true` to keep the effect active, or `false` to disable it.

```lua theme={null}
-- Called once when the script initializes.
function init(self: MyPathEffect, context: Context): boolean

    -- Return false to stop the script.
    return true
end
```

### `update`

<div class="signature">
  ```lua theme={null}
  update(self: T, path: PathData, node: NodeReadData) -> PathData
  ```
</div>

Called any time an input changes.
You receive the original [PathData](/scripting/api-reference/path/path-data) and must return the path
that should be used for rendering.

```lua theme={null}
function update(self: MyPathEffect, inPath: PathData): PathData
    local path = Path.new()
    return path
end
```

### `advance`

<div class="signature">
  ```lua theme={null}
  advance(self: T, seconds: number) -> boolean
  ```
</div>

Called every frame to advance the effect over time.
`seconds` is the time delta since the last frame.
Return `true` to keep the effect active, or `false` to disable it.

```lua theme={null}
function advance(self: MyPathEffect, seconds: number): boolean
  return false
end
```
