Skip to the content

Tutorials

How to put an effect on a real site: by pasting it into Webflow, by handing it to an AI, or by wiring the two files yourself. Pick a chapter on the left.

Webflow

Copy, paste, preview. The paste brings the section, its classes, its images and its code.

Before you pasteAdd Instrument Sans and Geist Mono to your site fonts: Site settings, Fonts, Google Fonts. Webflow removes any font the site has not installed.

Step 1

Copy the component

The component page of the Pixel image trail, With Webflow tab open, with the blue Copy to Webflow button under Step 1.
  1. Open the component page and its With Webflow tab.
  2. Click Copy to Webflow.
Step 2

Paste it

An empty page open in the Webflow Designer. The same page after the paste: the section fills the canvas and the Navigator lists Pixel trail section with Trail images, Section content, Status line, Footer line and Code Embed inside it.
  1. Open your page in the Designer.
  2. In the Navigator, select Body, then press Cmd + V (Ctrl + V on Windows).
  3. The Navigator shows what arrived: the section, its images, its Code Embed.
Step 3

See it run

The pasted section on the Designer canvas, with a grey notice saying the script embed only displays in preview mode or on the published site. Webflow Preview, with the Enable custom code switch turned on in the top left corner. Webflow Preview with the effect running: pixelated cards trail behind the cursor across the section.
  1. On the canvas the section stays still: the Designer does not run custom code.
  2. Click Preview.
  3. Turn on Enable custom code?
  4. Move the cursor: the effect runs.
Step 4

Swap the images

For effects that show pictures, like the pixel trail. The paste brings the pictures of the preview: replace them with yours.

The Navigator with the div Trail images, swap them here, open on seven images, one of them selected, and the Settings panel showing its file and a Replace Image button.
  1. In the Navigator, open Trail images (swap them here) and select an image.
  2. In Settings, click Replace Image… and choose yours.

Any number of images works, from one up. That div is hidden on the page: it is a store of pictures, not a gallery.

Step 5

Tune it

The pasted section selected in the Navigator, and the Settings panel open on Custom attributes with the Name field filled with data-width above the Value field filled with 60px.
  1. Select the section.
  2. In Settings, under Custom attributes, click +.
  3. Fill Name, then Value: for example data-width and 60px.

Every component page lists its settings in its With Webflow tab, with what each one does. An attribute on the section wins over the values written in the code.

Going further

On your own elements

Some effects play on a title, an image or a section of yours. They are carried by one custom attribute, added the same way as in Step 5. The component page gives its name and the values it takes.

Custom attributeWhat it does
data-pixel-reveal On a heading or a paragraph: the pixel reveal plays on it.
data-pixel-swap On an image box: the pixel swap plays on it. Leave the value empty.
data-text-scramble="scroll" On a text: the scramble plays on it. The value is the trigger, scroll or hover.

The Code Embed has to stay on the page: it holds the code the attribute calls.

Going further

On several pages

The code ships inside the Code Embed, and that is all one page needs. To run the same effect on several pages, move the code to the site instead:

  1. Copy the block of Step 2: Add custom CSS of the component page into Site settings, Custom code, Head code.
  2. Copy the block of Step 3: Add custom JS into Footer code.
  3. Delete the Code Embed from the pasted section: the same code in two places runs twice.

For one page only, the same two blocks go in the page settings, under Custom code.

AI

One prompt is the whole handover. It works in a chat window and in a coding agent.

Step 1

Copy the prompt

The component page with the With AI tab open on the prompt, and the Copy the AI prompt button in the side panel.
  1. Open the component page and its With AI tab.
  2. Click Copy the AI prompt.
  3. It carries the code, the markup, every setting and the pitfalls. Nothing to attach.
Step 2

Answer two questions

Paste the prompt into your assistant. Before writing any code, it asks:

  1. Do you want it exactly as in the preview, or only the effect on your own content?
  2. Where is it going: plain HTML, Webflow, React, Astro?

A coding agent that can see your project finds the second answer by itself. If you only want the effect, name the element that gets it and the images to use.

Step 3

Change what you like

Another timing, a different structure, one part only: ask for it. The prompt tells the assistant how the engine works and what breaks it.

Code

One stylesheet, one script, no build step. It runs in the browser only.

Step 1

Take the files

The component page with the Code tab open on Step 1, the two files and the tags to add, and the Download the code button in the side panel.
  1. Open the component page and its Code tab.
  2. Click Download the code: the files and their pictures.
  3. Add the tags of Step 1: stylesheet in the head, script before the closing body tag.

Some components also need GSAP or Matter.js. When one does, its page gives the tag.

Step 2

Mark the element

The script looks for one data attribute when the page is ready, and mounts itself on every element that carries it. For the pixel trail:

<section data-pixel-trail> … </section>

The complete markup is at Step 2 of the Code tab.

Step 3

Drive it from JavaScript

Only when the page changes after it has loaded, or when you want to hear from the effect. Taking the pixel trail:

// content added later, by a fetch, a router or a CMS
PixelTrail.auto(container);

// one element, by hand
const trail = PixelTrail.mount(element);
trail.destroy();

// what the effect reports
element.addEventListener('pixeltrail:spawn', (event) => {
  console.log(event.detail);
});

The names of each component are in the step Drive it from JavaScript of its Code tab.

Step 4

Change a setting

Three places, and the most precise one wins:

  1. On one element: a data attribute, for example data-hold="3".
  2. For the page: window.PixelTrailSettings, declared before the script.
  3. For good: DEFAULTS, at the top of the JS file.

Questions

Short answers about the paste, the limits and the plans.

Nothing moves on the canvas. Is the paste broken?
No. The Designer does not run custom code. Open Preview with Enable custom code? turned on, or the published site.
Do the images come with the paste?
Yes, the ones of the preview. Replace them with yours in the Settings panel.
Can I put the code in two places?
No. The same code in two places runs twice. Keep the Code Embed, or the site code, not both.
Can I delete the section that came with the paste?
Yes, once your own element carries the attribute and the code is still on the page. An effect that fills a whole section, like the pixel trail, keeps a section: mark yours before deleting ours.
Is there room for all that code?
Webflow allows 50 000 characters per Embed. Our biggest one is around 40 500, unminified, comments included. The button pack is larger and arrives in two Embeds.
Does this need a paid plan?
On a free site the paste lands and plays in Preview. Editing the Code Embed and using the custom code fields need a site plan.