> For the complete documentation index, see [llms.txt](https://infinitode-docs.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://infinitode-docs.gitbook.io/documentation/package-documentation/blurjs-package-documentation/blurjs-usage-examples.md).

# BlurJS Usage Examples

Simple usage examples for getting started with BlurJS.

## 1. Create a Basic HTML File

Firstly we're going to create a basic HTML file, with just a parent div and a child div.

```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Blur Example</title>
    <style>
        .parent {
            position: relative;
        }
    </style>
</head>
<body>
    <div class="parent">
        <div class="blur"></div>
    </div>
</body>
</html>

```

## 2. Add BlurJS

Now, let's add BlurJS to the project. For faster loading, we're going to use the `minified` version of BlurJS. Add this script tag at the bottom, just before the ending `</body>` tag.

```html
<script src="https://cdn.jsdelivr.net/gh/Infinitode/BlurJS@main/dist/blur.min.js"></script>
```

## 3. Make <mark style="color:purple;">Magic</mark>

After you've done that, let's finally make some <mark style="color:purple;">**`magic`**</mark>!

* Add this next to `<div class="blur"`, remember to put a space between them.

```css
blur-width="50px" blur-height="50px"
```

{% hint style="info" %}
You can experiment with adding other values as the height or width, like `100%` or even `6em`.

* You can also experiment with adding other properties, like for instance, moving the blur around using `blur-left` or `blur-top`.
* You can change the blur size, color, blur amount, and even the z-index, allowing you to position your blur above or below other elements.
  {% endhint %}

## 4. The End

Now that you've made some pretty cool blurs, why not let your creativity flow? Build brand new modern sites using BlurJS, or, who knows, even spice up some of your old sites with some carefully placed colored gradient blurs.

### Animate a blur

Add animation attributes directly to the blur element. Delays accept standard CSS time values.

```html
<div
    class="blur"
    blur-scale="1.15"
    blur-scale-duration="900ms"
    blur-scale-delay="150ms"
    blur-rotate="12deg"
    blur-rotate-duration="900ms"
    blur-rotate-delay="150ms"
    blur-mix-blend-mode="screen">
</div>
```

Scale and rotation use independent CSS transform properties. You can combine them without either animation replacing the other.

### Dynamic content

BlurJS initializes new `.blur` elements after they enter the DOM. No manual reinitialization is needed for content rendered by a single-page application.

{% hint style="success" %}
We'd love to see what you've created, be sure to tag us on X/Twitter [@InfinitodeLTD](https://twitter.com/InfinitodeLtd) when you share your BlurJS implementation using `#`<mark style="color:purple;">**BlurJS**</mark>.
{% endhint %}
