Home

Awesome

ngx-connection-beam

@omnedia/ngx-connection-beam is an Angular component that dynamically renders animated connection lines between two elements. With customizable curvature, colors, and animation settings, it creates visually striking connection beams between any two elements in your Angular application.

Features

Installation

Install the library using npm:

npm install @omnedia/ngx-connection-beam

Usage

Import the NgxConnectionBeamComponent in your Angular module or component:

import { NgxConnectionBeamComponent } from '@omnedia/ngx-connection-beam';

@Component({
  ...
  imports: [
    ...
    NgxConnectionBeamComponent,
  ],
  ...
})

Use the component in your template:

<div class="wrapper">
    <div #elementA></div>
    <div #elementB></div>

    <om-connection-beam
    [fromRef]="elementA"
    [toRef]="elementB"
    [curvature]="50"
    [pathColor]="'#ff5733'"
    [pathWidth]="3"
    [duration]="6"
    [gradientStartColor]="'#ffcc00'"
    [gradientStopColor]="'#3498db'"
    >
    </om-connection-beam>
</div>

How It Works

API

<om-connection-beam
  [fromRef]="fromElement"
  [toRef]="toElement"
  [curvature]="curvature"
  [pathColor]="pathColor"
  [pathWidth]="pathWidth"
  [pathOpacity]="pathOpacity"
  [gradientStartColor]="gradientStartColor"
  [gradientStopColor]="gradientStopColor"
  [duration]="duration"
  [delay]="delay"
  [reverse]="reverse"
  [startXOffset]="startXOffset"
  [startYOffset]="startYOffset"
  [endXOffset]="endXOffset"
  [endYOffset]="endYOffset"
>
</om-connection-beam>

Example

<div class="wrapper">
    <div #startElement></div>
    <div #endElement></div>

    <om-connection-beam
    [fromRef]="startElement"
    [toRef]="endElement"
    [curvature]="100"
    [pathColor]="'#e74c3c'"
    [gradientStartColor]="'#e74c3c'"
    [gradientStopColor]="'#9b59b6'"
    [duration]="5"
    [reverse]="true"
    >
    </om-connection-beam>
</div>

This example draws a curved connection beam between two elements with a red-to-purple gradient that animates over 5 seconds.

Contributing

Contributions are welcome. Please submit a pull request or open an issue to discuss your ideas.

License

This project is licensed under the MIT License.