CinematicImage
Image component with color extraction and optional hover effects.
Basic Usage
The simplest way to add cinematic lighting to images. The component extracts the dominant color and creates an ambient glow effect around the image.
import { AdaptiveProvider, CinematicImage } from "react-cinematic-lighting";
export default function App() {
return (
<AdaptiveProvider>
<CinematicImage
src="/nature.jpg"
alt="Beautiful landscape"
preset="spotify"
/>
</AdaptiveProvider>
);
}Hover Effects
Enable interactive hover animations that enhance the glow effect when users interact with the image. Perfect for image galleries and portfolios.
import { CinematicImage } from "react-cinematic-lighting";
export default function ImageGallery() {
return (
<div className="grid grid-cols-3 gap-4">
<CinematicImage
src="/image1.jpg"
alt="Image 1"
preset="neon"
hoverEffect
transitionDuration={0.5}
/>
<CinematicImage
src="/image2.jpg"
alt="Image 2"
preset="ambient"
hoverEffect
/>
<CinematicImage
src="/image3.jpg"
alt="Image 3"
preset="spotify"
hoverEffect
/>
</div>
);
}Custom Configuration
Fine-tune the lighting effect with custom preset configurations and respond to color changes.
import { CinematicImage } from "react-cinematic-lighting";
export default function CustomImage() {
return (
<CinematicImage
src="/photo.jpg"
alt="Custom styled image"
preset={{
intensity: 0.6,
blur: 80,
spread: "wide",
glow: true,
glowStrength: 40,
colorBoost: 1.5,
}}
objectFit="cover"
hoverEffect
onColorChange={(color) => {
console.log("Dominant color:", color);
}}
/>
);
}Props
srcstringrequiredImage source URL
altstringrequiredAlternative text for accessibility
presetPresetName | PresetConfigoptionalPreset name (youtube, netflix, spotify, apple, minimal, neon, ambient) or custom config object. Default: "ambient"
hoverEffectbooleanoptionalEnable hover animation effect. Default: false
transitionDurationnumberoptionalHover transition duration in seconds. Default: 0.3
objectFit"contain" | "cover" | "fill" | "none" | "scale-down"optionalCSS object-fit property for image scaling
intensitynumberoptionalGlow intensity from 0 to 1 (overrides preset value)
blurnumberoptionalBackground blur in pixels (overrides preset value)
glowbooleanoptionalEnable glow effect (overrides preset value)
glowStrengthnumberoptionalGlow strength in pixels (overrides preset value)
disabledbooleanoptionalDisable color extraction. Default: false
onColorChange(color: ColorRGB) => voidoptionalCallback function called when the extracted color changes
classNamestringoptionalAdditional CSS classes
styleReact.CSSPropertiesoptionalAdditional inline styles