File size: 1,017 Bytes
75fefa7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"use client";

import React from "react";
import { cn } from "@/utils/cn";
import { CoreFlame } from "./core-flame";

interface FlameBackgroundProps {
  intensity?: number; // 0-100, like CPU usage
  animate?: boolean;
  className?: string;
  children?: React.ReactNode;
}

export function FlameBackground({
  intensity = 0,
  animate = false,
  className,
  children,
}: FlameBackgroundProps) {
  // Convert 0-100 to 0-0.3 opacity
  const opacity = Math.min((intensity / 100) * 0.3, 0.3);

  // Speed increases with intensity
  const speed = Math.max(80 - (intensity / 100) * 40, 40);

  // Color gets more orange with intensity
  const color =
    intensity > 80 ? "heat-100" : intensity > 50 ? "heat-40" : "black-alpha-20";

  return (
    <div className={cn("relative", className)}>
      <CoreFlame
        className={cn(
          "transition-opacity duration-1000",
          animate && "animate-pulse",
        )}
      />
      {children && <div className="relative z-10">{children}</div>}
    </div>
  );
}