Canvas

Halo

Atmospheric scattering (Rayleigh & Mie) based halo effect with dynamic camera rotation and sun light simulation.


Installation

Install the component

Run the following command to install the component and its dependencies:
npx @motion-core/cli add halo
npx @motion-core/cli add halo
pnpm dlx @motion-core/cli add halo
pnpm dlx @motion-core/cli add halo
bunx @motion-core/cli add halo
bunx @motion-core/cli add halo
yarn dlx @motion-core/cli add halo
yarn dlx @motion-core/cli add halo

Import the component

Import the component into your Svelte file:
import { Halo } from "$lib/motion-core";
import { Halo } from "$lib/motion-core";

Usage

Props

1.000
0.000
0.000
0deg
0.500
3.000
2.200
<script lang="ts">
	import { Halo } from "motion-core";
	import type { ComponentProps } from "svelte";

	type Props = Partial<ComponentProps<typeof Halo>>;

	let {
		scale = 1,
		offsetX = 0,
		offsetY = 0,
		rotation = 0,
		rotationSpeed = 0.5,
		backgroundColor = "#17181A",
		cameraDistance = 3,
		intensity = 2.2,
	}: Props = $props();
</script>

<Halo
	class="h-full min-h-96 w-full"
	{scale}
	{offsetX}
	{offsetY}
	{rotation}
	{rotationSpeed}
	{backgroundColor}
	{cameraDistance}
	{intensity}
/>
<script lang="ts">
	import { Halo } from "motion-core";
	import type { ComponentProps } from "svelte";

	type Props = Partial<ComponentProps<typeof Halo>>;

	let {
		scale = 1,
		offsetX = 0,
		offsetY = 0,
		rotation = 0,
		rotationSpeed = 0.5,
		backgroundColor = "#17181A",
		cameraDistance = 3,
		intensity = 2.2,
	}: Props = $props();
</script>

<Halo
	class="h-full min-h-96 w-full"
	{scale}
	{offsetX}
	{offsetY}
	{rotation}
	{rotationSpeed}
	{backgroundColor}
	{cameraDistance}
	{intensity}
/>

Props

Halo

PropTypeDefault
scale
number 1
offsetX
number 0
offsetY
number 0
rotation
number 0
rotationSpeed
number 0.5
backgroundColor
stringnumber[number, number, number]{ r: number; g: number; b: number } "#17181A"
cameraDistance
number 3.0
sunX
number 0.0
sunY
number 0.0
sunZ
number 1.0
intensity
number 1.0
class
string ""