# Background Lines

Garis SVG yang tergambar lalu menghilang bergantian, berupa gelombang, sinar dari satu titik, atau kisi. Dibuat untuk hero.

- Kategori: Latar
- Status: stable
- Registry: https://markas.jenderalcorp.com/r/background-lines.json
- CLI: `npx markasui@latest add background-lines`

## Kapan dipakai

Hero, halaman 404, atau layar masuk yang butuh gerak tenang di belakang judul.

- Atur warna latar, padding, dan radius lewat class pada komponen
- Pakai muted atau count kecil di belakang form supaya kolom tetap mudah dibaca
- Pakai rays dengan padding atas supaya sumber cahaya berada di atas judul

## Kode

### Blade

Simpan di `resources/views/components/markas/background-lines.blade.php`. Tanpa dependensi tambahan.

```blade
@props([
    'variant' => 'waves',
    'count' => 12,
    'speed' => 'normal',
    'color' => 'primary',
])

@php
    $base = 'relative isolate overflow-hidden';
    $layer = 'pointer-events-none absolute inset-0 size-full [mask-image:radial-gradient(ellipse_at_center,black_35%,transparent_80%)]';
    $line = 'animate-[markas-lines-draw_var(--markas-lines-duration)_ease-in-out_infinite] motion-reduce:animate-none';
    $content = 'relative';
    $colors = [
        'muted' => 'text-muted',
        'primary' => 'text-primary',
        'success' => 'text-success',
        'warning' => 'text-warning',
        'danger' => 'text-danger',
    ];
    $speeds = ['slow' => '12s', 'normal' => '8s', 'fast' => '5s'];
    $keyframes = '@keyframes markas-lines-draw{0%{stroke-dashoffset:100}35%,65%{stroke-dashoffset:0}100%{stroke-dashoffset:-100}}';
    $maxLines = 24;
    $lineDelayMs = 650;
    $rayLength = 900;

    // Garis ke-i di kanvas 800x400. Hanya bilangan bulat (floor) supaya Blade, React, dan Vue sama persis.
    $total = max(0, min((int) $count, $maxLines));
    $lines = [];
    for ($i = 0; $i < $total; $i++) {
        if ($variant === 'rays') {
            $angle = (20 + ($i * 140) / max(1, $total - 1)) * M_PI / 180;
            $x = 400 + (int) floor(cos($angle) * $rayLength);
            $y = -40 + (int) floor(sin($angle) * $rayLength);
            $d = "M 400 -40 L {$x} {$y}";
        } elseif ($variant === 'lattice') {
            $pairs = (int) ceil($total / 2);
            $x = -400 + (int) floor(((2 * intdiv($i, 2) + 1) * 800) / $pairs);
            $d = $i % 2 === 0 ? 'M '.$x.' 0 L '.($x + 400).' 400' : 'M '.$x.' 400 L '.($x + 400).' 0';
        } else {
            $y = (int) floor(((2 * $i + 1) * 200) / $total);
            $amp = (24 + ($i % 4) * 10) * ($i % 2 === 0 ? 1 : -1);
            $d = 'M -40 '.$y.' C 160 '.($y - $amp).', 240 '.($y + $amp).', 400 '.$y.' S 640 '.($y - $amp).', 840 '.$y;
        }
        $lines[] = ['d' => $d, 'style' => 'opacity: '.((($i % 3) + 3) / 10).'; animation-delay: '.($i * -$lineDelayMs).'ms'];
    }
@endphp

<div {{ $attributes->merge(['style' => '--markas-lines-duration: '.($speeds[$speed] ?? $speeds['normal'])])->class([$base]) }}>
    <style>{!! $keyframes !!}</style>
    <svg aria-hidden="true" wire:ignore @class([$layer, $colors[$color] ?? $colors['primary']]) viewBox="0 0 800 400" preserveAspectRatio="xMidYMid slice" fill="none" stroke="currentColor" stroke-width="1.5">
        @foreach ($lines as $item)
            <path class="{{ $line }}" d="{{ $item['d'] }}" pathLength="100" stroke-dasharray="100" style="{{ $item['style'] }}"></path>
        @endforeach
    </svg>
    <div class="{{ $content }}">{{ $slot }}</div>
</div>
```

```blade
<x-markas.background-lines variant="waves" :count="12" class="rounded-xl bg-surface px-6 py-16">
    <h2 class="text-center text-3xl font-bold text-ink">Ide yang bergerak</h2>
</x-markas.background-lines>
```

Tidak butuh JavaScript atau Alpine.js.

### React

Simpan di `src/components/markas/BackgroundLines.tsx`. Tanpa dependensi tambahan.

```tsx
import type { ComponentProps, CSSProperties } from "react";

const base = "relative isolate overflow-hidden";
const layer =
  "pointer-events-none absolute inset-0 size-full [mask-image:radial-gradient(ellipse_at_center,black_35%,transparent_80%)]";
const line =
  "animate-[markas-lines-draw_var(--markas-lines-duration)_ease-in-out_infinite] motion-reduce:animate-none";
const content = "relative";
const colors = {
  muted: "text-muted",
  primary: "text-primary",
  success: "text-success",
  warning: "text-warning",
  danger: "text-danger",
};
const speeds = { slow: "12s", normal: "8s", fast: "5s" };
const keyframes =
  "@keyframes markas-lines-draw{0%{stroke-dashoffset:100}35%,65%{stroke-dashoffset:0}100%{stroke-dashoffset:-100}}";
const MAX_LINES = 24;
const LINE_DELAY_MS = 650;
const RAY_LENGTH = 900;
const cx = (...c: (string | false | null | undefined)[]) =>
  c.filter(Boolean).join(" ");

type Variant = "waves" | "rays" | "lattice";

/** Garis ke-i di kanvas 800x400. Hanya bilangan bulat (floor) supaya Blade, React, dan Vue sama persis. */
function linePath(variant: Variant, index: number, total: number) {
  if (variant === "rays") {
    const angle =
      ((20 + (index * 140) / Math.max(1, total - 1)) * Math.PI) / 180;
    const x = 400 + Math.floor(Math.cos(angle) * RAY_LENGTH);
    const y = -40 + Math.floor(Math.sin(angle) * RAY_LENGTH);
    return `M 400 -40 L ${x} ${y}`;
  }
  if (variant === "lattice") {
    const pairs = Math.ceil(total / 2);
    const x =
      -400 + Math.floor(((2 * Math.floor(index / 2) + 1) * 800) / pairs);
    return index % 2 === 0
      ? `M ${x} 0 L ${x + 400} 400`
      : `M ${x} 400 L ${x + 400} 0`;
  }
  const y = Math.floor(((2 * index + 1) * 200) / total);
  const amp = (24 + (index % 4) * 10) * (index % 2 === 0 ? 1 : -1);
  return `M -40 ${y} C 160 ${y - amp}, 240 ${y + amp}, 400 ${y} S 640 ${y - amp}, 840 ${y}`;
}

function makeLines(variant: Variant, count: number) {
  const total = Math.max(0, Math.min(Math.trunc(count), MAX_LINES));
  return Array.from({ length: total }, (_, index) => ({
    d: linePath(variant, index, total),
    style: {
      opacity: ((index % 3) + 3) / 10,
      animationDelay: `${index * -LINE_DELAY_MS}ms`,
    },
  }));
}

export type BackgroundLinesProps = ComponentProps<"div"> & {
  variant?: Variant;
  count?: number;
  speed?: keyof typeof speeds;
  color?: keyof typeof colors;
};

export function BackgroundLines({
  variant = "waves",
  count = 12,
  speed = "normal",
  color = "primary",
  className,
  style,
  children,
  ...props
}: BackgroundLinesProps) {
  const vars = { "--markas-lines-duration": speeds[speed] } as CSSProperties;

  return (
    <div
      {...props}
      className={cx(base, className)}
      style={{ ...vars, ...style }}
    >
      <style>{keyframes}</style>
      <svg
        aria-hidden="true"
        className={cx(layer, colors[color])}
        viewBox="0 0 800 400"
        preserveAspectRatio="xMidYMid slice"
        fill="none"
        stroke="currentColor"
        strokeWidth="1.5"
      >
        {makeLines(variant, count).map((item, index) => (
          <path
            key={index}
            className={line}
            d={item.d}
            pathLength={100}
            strokeDasharray="100"
            style={item.style}
          />
        ))}
      </svg>
      <div className={content}>{children}</div>
    </div>
  );
}
```

```tsx
import { BackgroundLines } from "@/components/markas/BackgroundLines";

<BackgroundLines
  variant="waves"
  count={12}
  className="rounded-xl bg-surface px-6 py-16"
>
  <h2 className="text-center text-3xl font-bold text-ink">Ide yang bergerak</h2>
</BackgroundLines>;
```

### Vue

Simpan di `src/components/markas/BackgroundLines.vue`. Tanpa dependensi tambahan.

```vue
<script setup lang="ts">
import { computed } from "vue";

const base = "relative isolate overflow-hidden";
const layer =
  "pointer-events-none absolute inset-0 size-full [mask-image:radial-gradient(ellipse_at_center,black_35%,transparent_80%)]";
const line =
  "animate-[markas-lines-draw_var(--markas-lines-duration)_ease-in-out_infinite] motion-reduce:animate-none";
const content = "relative";
const colors = {
  muted: "text-muted",
  primary: "text-primary",
  success: "text-success",
  warning: "text-warning",
  danger: "text-danger",
};
const speeds = { slow: "12s", normal: "8s", fast: "5s" };
const keyframes =
  "@keyframes markas-lines-draw{0%{stroke-dashoffset:100}35%,65%{stroke-dashoffset:0}100%{stroke-dashoffset:-100}}";
const MAX_LINES = 24;
const LINE_DELAY_MS = 650;
const RAY_LENGTH = 900;

type Variant = "waves" | "rays" | "lattice";

/** Garis ke-i di kanvas 800x400. Hanya bilangan bulat (floor) supaya Blade, React, dan Vue sama persis. */
function linePath(variant: Variant, index: number, total: number) {
  if (variant === "rays") {
    const angle =
      ((20 + (index * 140) / Math.max(1, total - 1)) * Math.PI) / 180;
    const x = 400 + Math.floor(Math.cos(angle) * RAY_LENGTH);
    const y = -40 + Math.floor(Math.sin(angle) * RAY_LENGTH);
    return `M 400 -40 L ${x} ${y}`;
  }
  if (variant === "lattice") {
    const pairs = Math.ceil(total / 2);
    const x =
      -400 + Math.floor(((2 * Math.floor(index / 2) + 1) * 800) / pairs);
    return index % 2 === 0
      ? `M ${x} 0 L ${x + 400} 400`
      : `M ${x} 400 L ${x + 400} 0`;
  }
  const y = Math.floor(((2 * index + 1) * 200) / total);
  const amp = (24 + (index % 4) * 10) * (index % 2 === 0 ? 1 : -1);
  return `M -40 ${y} C 160 ${y - amp}, 240 ${y + amp}, 400 ${y} S 640 ${y - amp}, 840 ${y}`;
}

function makeLines(variant: Variant, count: number) {
  const total = Math.max(0, Math.min(Math.trunc(count), MAX_LINES));
  return Array.from({ length: total }, (_, index) => ({
    d: linePath(variant, index, total),
    style: {
      opacity: ((index % 3) + 3) / 10,
      animationDelay: `${index * -LINE_DELAY_MS}ms`,
    },
  }));
}

const props = withDefaults(
  defineProps<{
    variant?: Variant;
    count?: number;
    speed?: keyof typeof speeds;
    color?: keyof typeof colors;
  }>(),
  { variant: "waves", count: 12, speed: "normal", color: "primary" },
);

const vars = computed(() => ({
  "--markas-lines-duration": speeds[props.speed],
}));
const lines = computed(() => makeLines(props.variant, props.count));
</script>

<template>
  <div :class="base" :style="vars">
    <component :is="'style'">{{ keyframes }}</component>
    <svg
      aria-hidden="true"
      :class="[layer, colors[props.color]]"
      viewBox="0 0 800 400"
      preserveAspectRatio="xMidYMid slice"
      fill="none"
      stroke="currentColor"
      stroke-width="1.5"
    >
      <path
        v-for="(item, index) in lines"
        :key="index"
        :class="line"
        :d="item.d"
        pathLength="100"
        stroke-dasharray="100"
        :style="item.style"
      />
    </svg>
    <div :class="content"><slot /></div>
  </div>
</template>
```

```vue
<template>
  <BackgroundLines
    variant="waves"
    :count="12"
    class="rounded-xl bg-surface px-6 py-16"
  >
    <h2 class="text-center text-3xl font-bold text-ink">Ide yang bergerak</h2>
  </BackgroundLines>
</template>
```

### Svelte

Simpan di `src/lib/components/markas/BackgroundLines.svelte`. Tanpa dependensi tambahan.

```svelte
<script lang="ts">
  import type { Snippet } from "svelte";
  import type { HTMLAttributes } from "svelte/elements";

  const base = "relative isolate overflow-hidden";
  const layer =
    "pointer-events-none absolute inset-0 size-full [mask-image:radial-gradient(ellipse_at_center,black_35%,transparent_80%)]";
  const line =
    "animate-[markas-lines-draw_var(--markas-lines-duration)_ease-in-out_infinite] motion-reduce:animate-none";
  const content = "relative";
  const colors = {
    muted: "text-muted",
    primary: "text-primary",
    success: "text-success",
    warning: "text-warning",
    danger: "text-danger",
  };
  const speeds = { slow: "12s", normal: "8s", fast: "5s" };
  const keyframes =
    "@keyframes markas-lines-draw{0%{stroke-dashoffset:100}35%,65%{stroke-dashoffset:0}100%{stroke-dashoffset:-100}}";
  const MAX_LINES = 24;
  const LINE_DELAY_MS = 650;
  const RAY_LENGTH = 900;

  type Variant = "waves" | "rays" | "lattice";

  /** Garis ke-i di kanvas 800x400. Hanya bilangan bulat (floor) supaya semua framework sama persis. */
  function linePath(variant: Variant, index: number, total: number) {
    if (variant === "rays") {
      const angle =
        ((20 + (index * 140) / Math.max(1, total - 1)) * Math.PI) / 180;
      const x = 400 + Math.floor(Math.cos(angle) * RAY_LENGTH);
      const y = -40 + Math.floor(Math.sin(angle) * RAY_LENGTH);
      return `M 400 -40 L ${x} ${y}`;
    }
    if (variant === "lattice") {
      const pairs = Math.ceil(total / 2);
      const x =
        -400 + Math.floor(((2 * Math.floor(index / 2) + 1) * 800) / pairs);
      return index % 2 === 0
        ? `M ${x} 0 L ${x + 400} 400`
        : `M ${x} 400 L ${x + 400} 0`;
    }
    const y = Math.floor(((2 * index + 1) * 200) / total);
    const amp = (24 + (index % 4) * 10) * (index % 2 === 0 ? 1 : -1);
    return `M -40 ${y} C 160 ${y - amp}, 240 ${y + amp}, 400 ${y} S 640 ${y - amp}, 840 ${y}`;
  }

  function makeLines(variant: Variant, count: number) {
    const total = Math.max(0, Math.min(Math.trunc(count), MAX_LINES));
    return Array.from({ length: total }, (_, index) => ({
      d: linePath(variant, index, total),
      style: `opacity:${((index % 3) + 3) / 10};animation-delay:${index * -LINE_DELAY_MS}ms`,
    }));
  }

  type Props = HTMLAttributes<HTMLDivElement> & {
    variant?: Variant;
    count?: number;
    speed?: keyof typeof speeds;
    color?: keyof typeof colors;
    children?: Snippet;
  };

  let {
    variant = "waves",
    count = 12,
    speed = "normal",
    color = "primary",
    class: className,
    style,
    children,
    ...rest
  }: Props = $props();

  const lines = $derived(makeLines(variant, count));
</script>

<div
  {...rest}
  class={[base, className]}
  style="--markas-lines-duration:{speeds[speed]};{style ?? ''}"
>
  {@html `<style>${keyframes}</style>`}
  <svg
    aria-hidden="true"
    class={[layer, colors[color]]}
    viewBox="0 0 800 400"
    preserveAspectRatio="xMidYMid slice"
    fill="none"
    stroke="currentColor"
    stroke-width="1.5"
  >
    {#each lines as item, index (index)}
      <path
        class={line}
        d={item.d}
        pathLength="100"
        stroke-dasharray="100"
        style={item.style}
      />
    {/each}
  </svg>
  <div class={content}>{@render children?.()}</div>
</div>
```

```svelte
<script lang="ts">
  import BackgroundLines from "$lib/components/markas/BackgroundLines.svelte";
</script>

<BackgroundLines
  variant="waves"
  count={12}
  class="rounded-xl bg-surface px-6 py-16"
>
  <h2 class="text-center text-3xl font-bold text-ink">Ide yang bergerak</h2>
</BackgroundLines>
```

### Astro

Simpan di `src/components/markas/BackgroundLines.astro`. Tanpa dependensi tambahan.

```astro
---
import type { HTMLAttributes } from "astro/types";

const base = "relative isolate overflow-hidden";
const layer =
  "pointer-events-none absolute inset-0 size-full [mask-image:radial-gradient(ellipse_at_center,black_35%,transparent_80%)]";
const line =
  "animate-[markas-lines-draw_var(--markas-lines-duration)_ease-in-out_infinite] motion-reduce:animate-none";
const content = "relative";
const colors = {
  muted: "text-muted",
  primary: "text-primary",
  success: "text-success",
  warning: "text-warning",
  danger: "text-danger",
};
const speeds = { slow: "12s", normal: "8s", fast: "5s" };
const keyframes =
  "@keyframes markas-lines-draw{0%{stroke-dashoffset:100}35%,65%{stroke-dashoffset:0}100%{stroke-dashoffset:-100}}";
const MAX_LINES = 24;
const LINE_DELAY_MS = 650;
const RAY_LENGTH = 900;

type Variant = "waves" | "rays" | "lattice";

/** Garis ke-i di kanvas 800x400. Hanya bilangan bulat (floor) supaya semua framework sama persis. */
function linePath(variant: Variant, index: number, total: number) {
  if (variant === "rays") {
    const angle =
      ((20 + (index * 140) / Math.max(1, total - 1)) * Math.PI) / 180;
    const x = 400 + Math.floor(Math.cos(angle) * RAY_LENGTH);
    const y = -40 + Math.floor(Math.sin(angle) * RAY_LENGTH);
    return `M 400 -40 L ${x} ${y}`;
  }
  if (variant === "lattice") {
    const pairs = Math.ceil(total / 2);
    const x =
      -400 + Math.floor(((2 * Math.floor(index / 2) + 1) * 800) / pairs);
    return index % 2 === 0
      ? `M ${x} 0 L ${x + 400} 400`
      : `M ${x} 400 L ${x + 400} 0`;
  }
  const y = Math.floor(((2 * index + 1) * 200) / total);
  const amp = (24 + (index % 4) * 10) * (index % 2 === 0 ? 1 : -1);
  return `M -40 ${y} C 160 ${y - amp}, 240 ${y + amp}, 400 ${y} S 640 ${y - amp}, 840 ${y}`;
}

function makeLines(variant: Variant, count: number) {
  const total = Math.max(0, Math.min(Math.trunc(count), MAX_LINES));
  return Array.from({ length: total }, (_, index) => ({
    d: linePath(variant, index, total),
    style: `opacity:${((index % 3) + 3) / 10};animation-delay:${index * -LINE_DELAY_MS}ms`,
  }));
}

type Props = Omit<HTMLAttributes<"div">, "style"> & {
  variant?: Variant;
  count?: number;
  speed?: keyof typeof speeds;
  color?: keyof typeof colors;
  style?: string;
};

const {
  variant = "waves",
  count = 12,
  speed = "normal",
  color = "primary",
  class: className,
  style,
  ...rest
} = Astro.props;
---

<div
  {...rest}
  class:list={[base, className]}
  style={`--markas-lines-duration:${speeds[speed]};${style ?? ""}`}
>
  <style is:inline set:html={keyframes} />
  <svg
    aria-hidden="true"
    class:list={[layer, colors[color]]}
    viewBox="0 0 800 400"
    preserveAspectRatio="xMidYMid slice"
    fill="none"
    stroke="currentColor"
    stroke-width="1.5"
  >
    {
      makeLines(variant, count).map((item) => (
        <path
          class={line}
          d={item.d}
          pathLength="100"
          stroke-dasharray="100"
          style={item.style}
        />
      ))
    }
  </svg>
  <div class={content}><slot /></div>
</div>
```

```astro
---
import BackgroundLines from "@/components/markas/BackgroundLines.astro";
---

<BackgroundLines
  variant="waves"
  count={12}
  class="rounded-xl bg-surface px-6 py-16"
>
  <h2 class="text-center text-3xl font-bold text-ink">Ide yang bergerak</h2>
</BackgroundLines>
```

Tanpa JavaScript di browser; markup dirender di server.

### Angular

Simpan di `src/app/markas/background-lines.component.ts`. Tanpa dependensi tambahan.

```ts
import {
  ChangeDetectionStrategy,
  Component,
  computed,
  input,
  numberAttribute,
  ViewEncapsulation,
} from "@angular/core";

const base = "relative isolate overflow-hidden";
const layer =
  "pointer-events-none absolute inset-0 size-full [mask-image:radial-gradient(ellipse_at_center,black_35%,transparent_80%)]";
const line =
  "animate-[markas-lines-draw_var(--markas-lines-duration)_ease-in-out_infinite] motion-reduce:animate-none";
const content = "relative";
const colors = {
  muted: "text-muted",
  primary: "text-primary",
  success: "text-success",
  warning: "text-warning",
  danger: "text-danger",
};
const speeds = { slow: "12s", normal: "8s", fast: "5s" };
const keyframes =
  "@keyframes markas-lines-draw{0%{stroke-dashoffset:100}35%,65%{stroke-dashoffset:0}100%{stroke-dashoffset:-100}}";
const MAX_LINES = 24;
const LINE_DELAY_MS = 650;
const RAY_LENGTH = 900;

export type BackgroundLinesVariant = "waves" | "rays" | "lattice";
export type BackgroundLinesSpeed = keyof typeof speeds;
export type BackgroundLinesColor = keyof typeof colors;

/** Garis ke-i di kanvas 800x400. Hanya bilangan bulat (floor) supaya semua framework sama persis. */
function linePath(
  variant: BackgroundLinesVariant,
  index: number,
  total: number,
) {
  if (variant === "rays") {
    const angle =
      ((20 + (index * 140) / Math.max(1, total - 1)) * Math.PI) / 180;
    const x = 400 + Math.floor(Math.cos(angle) * RAY_LENGTH);
    const y = -40 + Math.floor(Math.sin(angle) * RAY_LENGTH);
    return `M 400 -40 L ${x} ${y}`;
  }
  if (variant === "lattice") {
    const pairs = Math.ceil(total / 2);
    const x =
      -400 + Math.floor(((2 * Math.floor(index / 2) + 1) * 800) / pairs);
    return index % 2 === 0
      ? `M ${x} 0 L ${x + 400} 400`
      : `M ${x} 400 L ${x + 400} 0`;
  }
  const y = Math.floor(((2 * index + 1) * 200) / total);
  const amp = (24 + (index % 4) * 10) * (index % 2 === 0 ? 1 : -1);
  return `M -40 ${y} C 160 ${y - amp}, 240 ${y + amp}, 400 ${y} S 640 ${y - amp}, 840 ${y}`;
}

function makeLines(variant: BackgroundLinesVariant, count: number) {
  const total = Math.max(0, Math.min(Math.trunc(count), MAX_LINES));
  return Array.from({ length: total }, (_, index) => ({
    d: linePath(variant, index, total),
    style: `opacity:${((index % 3) + 3) / 10};animation-delay:${index * -LINE_DELAY_MS}ms`,
  }));
}

/**
 * Attribute selector on a native div: the user's class, style, and attributes stay on the
 * root. The keyframes are a global style, so encapsulation is off.
 */
@Component({
  selector: "div[markas-background-lines]",
  changeDetection: ChangeDetectionStrategy.OnPush,
  encapsulation: ViewEncapsulation.None,
  styles: [keyframes],
  host: {
    "[class]": "base",
    "[style.--markas-lines-duration]": "duration()",
  },
  template: `
    <svg
      aria-hidden="true"
      [class]="layerClasses()"
      viewBox="0 0 800 400"
      preserveAspectRatio="xMidYMid slice"
      fill="none"
      stroke="currentColor"
      stroke-width="1.5"
    >
      @for (item of lines(); track $index) {
        <path
          [class]="line"
          [attr.d]="item.d"
          pathLength="100"
          stroke-dasharray="100"
          [style]="item.style"
        />
      }
    </svg>
    <div [class]="content"><ng-content /></div>
  `,
})
export class BackgroundLines {
  readonly variant = input<BackgroundLinesVariant>("waves");
  readonly count = input(12, { transform: numberAttribute });
  readonly speed = input<BackgroundLinesSpeed>("normal");
  readonly color = input<BackgroundLinesColor>("primary");

  protected readonly base = base;
  protected readonly line = line;
  protected readonly content = content;
  protected readonly duration = computed(() => speeds[this.speed()]);
  protected readonly layerClasses = computed(
    () => `${layer} ${colors[this.color()]}`,
  );
  protected readonly lines = computed(() =>
    makeLines(this.variant(), this.count()),
  );
}
```

```ts
import { Component } from "@angular/core";
import { BackgroundLines } from "./markas/background-lines.component";

@Component({
  selector: "app-hero",
  imports: [BackgroundLines],
  template: `
    <div
      markas-background-lines
      variant="waves"
      [count]="12"
      class="rounded-xl bg-surface px-6 py-16"
    >
      <h2 class="text-center text-3xl font-bold text-ink">Ide yang bergerak</h2>
    </div>
  `,
})
export class Hero {}
```

Komponen ini berupa atribut pada div, jadi class, style, dan atribut lain tetap di elemen akar.

## Props

| Nama | Tipe | Default | Keterangan |
| --- | --- | --- | --- |
| `variant` | `waves \| rays \| lattice` | waves | waves menumpuk kurva lembut, rays memancarkan garis dari tengah atas, lattice menyilangkan garis diagonal. |
| `count` | `number` | 12 | Jumlah garis, maksimal 24. |
| `speed` | `slow \| normal \| fast` | normal | Panjang satu siklus gambar dan pudar: 12s, 8s, atau 5s. |
| `color` | `muted \| primary \| success \| warning \| danger` | primary | Warna token garis. |
| `children / slot` | `slot / ReactNode / snippet` | - | Konten yang tampil di atas garis. |

## Aksesibilitas

- Lapisan garis memakai aria-hidden dan mengabaikan pointer.
- Dengan reduced motion, semua garis tampil utuh dan diam.
- Posisi garis berasal dari rumus, jadi server dan klien merender markup yang sama.

## Catatan

- Setiap garis tergambar, bertahan, lalu memudar, bergeser dari garis tetangganya supaya gambar tidak pernah kosong.
- `rays` memancar dari tengah atas: beri padding atas supaya sumber cahaya berada di atas judul.
- Garis mengikuti ukuran area (gambar 800x400 menutupinya seperti `object-fit: cover`).
- Komponen ini tidak punya teks bawaan, jadi tidak ada prop label yang perlu diterjemahkan.
