# Developing instant photo card

> An instant photo that turns from a dark smear into a sunset in color after a shake, with a handwritten caption.

- Category: [Cards](https://library.aimran.es/components/cards)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-card-polaroid
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

Instant photos have a ritual: shake, wait, watch the image appear. This card recreates it with layered CSS gradients for the beach scene, a dark developing layer that fades out slowly, and a short wobble on click. It fits travel journals, photo apps, event recaps and any portfolio that wants a warm, tactile detail.

Use the main color for the sunset sky and the second one for the sea, and change the caption to a place and a date. Place a few of them at different angles to build a scrapbook wall.

## Code

### HTML

```html
<button type="button" class="uvq07-pol" aria-pressed="false"><span class="fr"><span class="ph" aria-hidden="true"><i class="sk"></i><i class="sn"></i><i class="se"></i><i class="sa"></i><i class="dv"></i></span><span class="cp">Cádiz, August</span></span><span class="hn"><span class="h1">Tap to develop</span><span class="h2">Tap again to repeat</span></span></button>
```

### CSS

```css
.uvq07-pol {
  --c1: #f29e4c;
  --c2: #1f6f8b;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq07-pol {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  display: grid;
  justify-items: center;
  gap: 1.1em;
  width: 15em;
  text-align: center;
}

.uvq07-pol .fr {
  display: block;
  width: 13em;
  padding: .75em .75em 0;
  border-radius: .15em;
  background: linear-gradient(160deg,#fffefb,#f0ece2);
  box-shadow: 0 .1em .2em rgba(0,0,0,.12),0 1.6em 2.6em -1.2em rgba(0,0,0,.5);
  transform: rotate(-3deg);
  transition: transform calc(0.5s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq07-pol:hover .fr {
  transform: rotate(-1deg) translateY(-.3em);
}

.uvq07-pol:active .fr {
  transform: rotate(-2deg) scale(.97);
}

.uvq07-pol:focus-visible {
  outline: 0;
}

.uvq07-pol:focus-visible .fr {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq07-pol .ph {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  filter: saturate(.15) sepia(.5) contrast(.8);
  transition: filter calc(0.6s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-pol .ph i {
  position: absolute;
  display: block;
}

.uvq07-pol .sk {
  inset: 0;
  background: linear-gradient(180deg,color-mix(in srgb,var(--c1) 35%,#ffe6cf),var(--c1) 52%,color-mix(in srgb,var(--c1) 70%,#d9485f) 62%);
}

.uvq07-pol .sn {
  left: 50%;
  top: 58%;
  width: 36%;
  aspect-ratio: 1;
  border-radius: 50%;
  translate: -50% -50%;
  background: radial-gradient(circle,#fffbe8 35%,color-mix(in srgb,var(--c1) 45%,#fff2c2) 70%);
  box-shadow: 0 0 1.5em .3em color-mix(in srgb,var(--c1) 60%,#fff6d0);
}

.uvq07-pol .se {
  left: 0;
  right: 0;
  top: 60%;
  bottom: 16%;
  background: repeating-linear-gradient(180deg,rgba(255,255,255,.16) 0 1px,transparent 1px 6px),linear-gradient(180deg,color-mix(in srgb,var(--c2) 70%,var(--c1)),var(--c2));
}

.uvq07-pol .se::after {
  content: "";
  position: absolute;
  left: 41%;
  width: 18%;
  top: 0;
  bottom: 0;
  background: repeating-linear-gradient(180deg,#ffe2a8 0 2px,transparent 2px 6px);
  opacity: .75;
  -webkit-mask: linear-gradient(#000,transparent);
  mask: linear-gradient(#000,transparent);
}

.uvq07-pol .sa {
  left: 0;
  right: 0;
  bottom: 0;
  height: 16%;
  background: linear-gradient(180deg,#ecd3a5,#d6b07a);
}

.uvq07-pol .dv {
  inset: 0;
  background: radial-gradient(circle at 45% 40%,#4a463d,#1c1b18 75%);
  transition: opacity calc(0.6s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-pol[aria-pressed="true"] .ph {
  filter: none;
  transition-duration: calc(3s / var(--k));
}

.uvq07-pol[aria-pressed="true"] .dv {
  opacity: 0;
  transition-duration: calc(3.2s / var(--k));
}

.uvq07-pol .cp {
  display: block;
  padding: .6em .2em .85em;
  font-family: "Segoe Print","Bradley Hand","Marker Felt","Comic Sans MS",cursive;
  font-size: 1.3em;
  line-height: 1.2;
  color: #2b2a33;
  transform: rotate(-1.5deg);
}

.uvq07-pol .hn {
  display: grid;
  font-size: .78em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq07-pol .hn>span {
  grid-area: 1/1;
  transition: opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-pol .h2,.uvq07-pol[aria-pressed="true"] .h1 {
  opacity: 0;
}

.uvq07-pol[aria-pressed="true"] .h2 {
  opacity: 1;
}

.uvq07-pol.shk .fr {
  animation: uvq07-pol calc(0.7s / var(--k)) ease-in-out;
}

@keyframes uvq07-pol {
  20% {
    transform: rotate(4deg) translateX(.5em);
  }
  40% {
    transform: rotate(-7deg) translateX(-.5em);
  }
  60% {
    transform: rotate(3deg) translateX(.3em);
  }
  80% {
    transform: rotate(-5deg);
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq07-pol,.uvq07-pol *,.uvq07-pol *::before,.uvq07-pol *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
```

### JavaScript

```js
document.querySelectorAll(".uvq07-pol").forEach(el => {
  el.addEventListener("click",()=>{const on=el.getAttribute("aria-pressed")!=="true";el.setAttribute("aria-pressed",String(on));el.classList.remove("shk");void el.offsetWidth;if(on)el.classList.add("shk")});
const t=setTimeout(()=>el.setAttribute("aria-pressed","true"),400);return()=>clearTimeout(t)
});
```

### React

```tsx
// @ts-nocheck: setup() es JavaScript del DOM sin tipos, el mismo de la pestaña JS.
import { useEffect, useRef, type CSSProperties } from "react";

const css = `
.uvq07-pol {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  display: grid;
  justify-items: center;
  gap: 1.1em;
  width: 15em;
  text-align: center;
}

.uvq07-pol .fr {
  display: block;
  width: 13em;
  padding: .75em .75em 0;
  border-radius: .15em;
  background: linear-gradient(160deg,#fffefb,#f0ece2);
  box-shadow: 0 .1em .2em rgba(0,0,0,.12),0 1.6em 2.6em -1.2em rgba(0,0,0,.5);
  transform: rotate(-3deg);
  transition: transform calc(0.5s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq07-pol:hover .fr {
  transform: rotate(-1deg) translateY(-.3em);
}

.uvq07-pol:active .fr {
  transform: rotate(-2deg) scale(.97);
}

.uvq07-pol:focus-visible {
  outline: 0;
}

.uvq07-pol:focus-visible .fr {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq07-pol .ph {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  filter: saturate(.15) sepia(.5) contrast(.8);
  transition: filter calc(0.6s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-pol .ph i {
  position: absolute;
  display: block;
}

.uvq07-pol .sk {
  inset: 0;
  background: linear-gradient(180deg,color-mix(in srgb,var(--c1) 35%,#ffe6cf),var(--c1) 52%,color-mix(in srgb,var(--c1) 70%,#d9485f) 62%);
}

.uvq07-pol .sn {
  left: 50%;
  top: 58%;
  width: 36%;
  aspect-ratio: 1;
  border-radius: 50%;
  translate: -50% -50%;
  background: radial-gradient(circle,#fffbe8 35%,color-mix(in srgb,var(--c1) 45%,#fff2c2) 70%);
  box-shadow: 0 0 1.5em .3em color-mix(in srgb,var(--c1) 60%,#fff6d0);
}

.uvq07-pol .se {
  left: 0;
  right: 0;
  top: 60%;
  bottom: 16%;
  background: repeating-linear-gradient(180deg,rgba(255,255,255,.16) 0 1px,transparent 1px 6px),linear-gradient(180deg,color-mix(in srgb,var(--c2) 70%,var(--c1)),var(--c2));
}

.uvq07-pol .se::after {
  content: "";
  position: absolute;
  left: 41%;
  width: 18%;
  top: 0;
  bottom: 0;
  background: repeating-linear-gradient(180deg,#ffe2a8 0 2px,transparent 2px 6px);
  opacity: .75;
  -webkit-mask: linear-gradient(#000,transparent);
  mask: linear-gradient(#000,transparent);
}

.uvq07-pol .sa {
  left: 0;
  right: 0;
  bottom: 0;
  height: 16%;
  background: linear-gradient(180deg,#ecd3a5,#d6b07a);
}

.uvq07-pol .dv {
  inset: 0;
  background: radial-gradient(circle at 45% 40%,#4a463d,#1c1b18 75%);
  transition: opacity calc(0.6s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-pol[aria-pressed="true"] .ph {
  filter: none;
  transition-duration: calc(3s / var(--k));
}

.uvq07-pol[aria-pressed="true"] .dv {
  opacity: 0;
  transition-duration: calc(3.2s / var(--k));
}

.uvq07-pol .cp {
  display: block;
  padding: .6em .2em .85em;
  font-family: "Segoe Print","Bradley Hand","Marker Felt","Comic Sans MS",cursive;
  font-size: 1.3em;
  line-height: 1.2;
  color: #2b2a33;
  transform: rotate(-1.5deg);
}

.uvq07-pol .hn {
  display: grid;
  font-size: .78em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq07-pol .hn>span {
  grid-area: 1/1;
  transition: opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-pol .h2,.uvq07-pol[aria-pressed="true"] .h1 {
  opacity: 0;
}

.uvq07-pol[aria-pressed="true"] .h2 {
  opacity: 1;
}

.uvq07-pol.shk .fr {
  animation: uvq07-pol calc(0.7s / var(--k)) ease-in-out;
}

@keyframes uvq07-pol {
  20% {
    transform: rotate(4deg) translateX(.5em);
  }
  40% {
    transform: rotate(-7deg) translateX(-.5em);
  }
  60% {
    transform: rotate(3deg) translateX(.3em);
  }
  80% {
    transform: rotate(-5deg);
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq07-pol,.uvq07-pol *,.uvq07-pol *::before,.uvq07-pol *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
`;

// Interacción en JavaScript del DOM: la misma que en la pestaña JS.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setup(el: any) {
  el.addEventListener("click",()=>{const on=el.getAttribute("aria-pressed")!=="true";el.setAttribute("aria-pressed",String(on));el.classList.remove("shk");void el.offsetWidth;if(on)el.classList.add("shk")});
const t=setTimeout(()=>el.setAttribute("aria-pressed","true"),400);return()=>clearTimeout(t)
}

export default function CardPolaroid() {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current?.firstElementChild;
    return el ? setup(el) : undefined;
  }, []);

  return (
    <>
      <style>{css}</style>
      <div
        ref={ref} style={{
          "--c1": "#f29e4c",
          "--c2": "#1f6f8b",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <button type="button" className="uvq07-pol" aria-pressed="false"><span className="fr"><span className="ph" aria-hidden="true"><i className="sk"></i><i className="sn"></i><i className="se"></i><i className="sa"></i><i className="dv"></i></span><span className="cp">Cádiz, August</span></span><span className="hn"><span className="h1">Tap to develop</span><span className="h2">Tap again to repeat</span></span></button>
      </div>
    </>
  );
}
```

## Prompt for AI assistants

Paste this into ChatGPT, Claude, Cursor, v0 or Lovable to adapt the block to your stack (Tailwind, Vue, Svelte…):

````text
I want to add the “Developing instant photo card” block (Cards) from AIMRAN Library to my project.

## What it is
An instant photo that turns from a dark smear into a sunset in color after a shake, with a handwritten caption.

## Chosen settings
- Main color: #f29e4c
- Secondary color: #1f6f8b
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Cádiz, agosto"

## What I need
1. Add it to my project with the same look and animation as the reference code: same sizes, colours, radii, shadows, timings and easing.
2. It is built with plain HTML and CSS (the reference wraps it in a React component with its CSS). If my project uses something else (Vue, Svelte, Astro, plain HTML…), translate it without losing any behaviour. If I use Tailwind, turn the styles into classes; if not, keep the CSS in its own file.
3. Expose the settings above as props (or CSS variables) with those values as defaults.
4. Make it work well on phones: nothing that depends only on hover, touch targets of at least 44 px and no overflow on 320 px screens.
5. Make it look right in light and dark mode.
6. Keep it accessible: semantic HTML, roles and aria-* where needed, visible focus and keyboard support.
7. Respect prefers-reduced-motion: with reduced motion, no big animations but the same end result.

## Reference code
```tsx
// @ts-nocheck: setup() es JavaScript del DOM sin tipos, el mismo de la pestaña JS.
import { useEffect, useRef, type CSSProperties } from "react";

const css = `
.uvq07-pol {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  display: grid;
  justify-items: center;
  gap: 1.1em;
  width: 15em;
  text-align: center;
}

.uvq07-pol .fr {
  display: block;
  width: 13em;
  padding: .75em .75em 0;
  border-radius: .15em;
  background: linear-gradient(160deg,#fffefb,#f0ece2);
  box-shadow: 0 .1em .2em rgba(0,0,0,.12),0 1.6em 2.6em -1.2em rgba(0,0,0,.5);
  transform: rotate(-3deg);
  transition: transform calc(0.5s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq07-pol:hover .fr {
  transform: rotate(-1deg) translateY(-.3em);
}

.uvq07-pol:active .fr {
  transform: rotate(-2deg) scale(.97);
}

.uvq07-pol:focus-visible {
  outline: 0;
}

.uvq07-pol:focus-visible .fr {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq07-pol .ph {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  filter: saturate(.15) sepia(.5) contrast(.8);
  transition: filter calc(0.6s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-pol .ph i {
  position: absolute;
  display: block;
}

.uvq07-pol .sk {
  inset: 0;
  background: linear-gradient(180deg,color-mix(in srgb,var(--c1) 35%,#ffe6cf),var(--c1) 52%,color-mix(in srgb,var(--c1) 70%,#d9485f) 62%);
}

.uvq07-pol .sn {
  left: 50%;
  top: 58%;
  width: 36%;
  aspect-ratio: 1;
  border-radius: 50%;
  translate: -50% -50%;
  background: radial-gradient(circle,#fffbe8 35%,color-mix(in srgb,var(--c1) 45%,#fff2c2) 70%);
  box-shadow: 0 0 1.5em .3em color-mix(in srgb,var(--c1) 60%,#fff6d0);
}

.uvq07-pol .se {
  left: 0;
  right: 0;
  top: 60%;
  bottom: 16%;
  background: repeating-linear-gradient(180deg,rgba(255,255,255,.16) 0 1px,transparent 1px 6px),linear-gradient(180deg,color-mix(in srgb,var(--c2) 70%,var(--c1)),var(--c2));
}

.uvq07-pol .se::after {
  content: "";
  position: absolute;
  left: 41%;
  width: 18%;
  top: 0;
  bottom: 0;
  background: repeating-linear-gradient(180deg,#ffe2a8 0 2px,transparent 2px 6px);
  opacity: .75;
  -webkit-mask: linear-gradient(#000,transparent);
  mask: linear-gradient(#000,transparent);
}

.uvq07-pol .sa {
  left: 0;
  right: 0;
  bottom: 0;
  height: 16%;
  background: linear-gradient(180deg,#ecd3a5,#d6b07a);
}

.uvq07-pol .dv {
  inset: 0;
  background: radial-gradient(circle at 45% 40%,#4a463d,#1c1b18 75%);
  transition: opacity calc(0.6s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-pol[aria-pressed="true"] .ph {
  filter: none;
  transition-duration: calc(3s / var(--k));
}

.uvq07-pol[aria-pressed="true"] .dv {
  opacity: 0;
  transition-duration: calc(3.2s / var(--k));
}

.uvq07-pol .cp {
  display: block;
  padding: .6em .2em .85em;
  font-family: "Segoe Print","Bradley Hand","Marker Felt","Comic Sans MS",cursive;
  font-size: 1.3em;
  line-height: 1.2;
  color: #2b2a33;
  transform: rotate(-1.5deg);
}

.uvq07-pol .hn {
  display: grid;
  font-size: .78em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq07-pol .hn>span {
  grid-area: 1/1;
  transition: opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq07-pol .h2,.uvq07-pol[aria-pressed="true"] .h1 {
  opacity: 0;
}

.uvq07-pol[aria-pressed="true"] .h2 {
  opacity: 1;
}

.uvq07-pol.shk .fr {
  animation: uvq07-pol calc(0.7s / var(--k)) ease-in-out;
}

@keyframes uvq07-pol {
  20% {
    transform: rotate(4deg) translateX(.5em);
  }
  40% {
    transform: rotate(-7deg) translateX(-.5em);
  }
  60% {
    transform: rotate(3deg) translateX(.3em);
  }
  80% {
    transform: rotate(-5deg);
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq07-pol,.uvq07-pol *,.uvq07-pol *::before,.uvq07-pol *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
`;

// Interacción en JavaScript del DOM: la misma que en la pestaña JS.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setup(el: any) {
  el.addEventListener("click",()=>{const on=el.getAttribute("aria-pressed")!=="true";el.setAttribute("aria-pressed",String(on));el.classList.remove("shk");void el.offsetWidth;if(on)el.classList.add("shk")});
const t=setTimeout(()=>el.setAttribute("aria-pressed","true"),400);return()=>clearTimeout(t)
}

export default function CardPolaroid() {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current?.firstElementChild;
    return el ? setup(el) : undefined;
  }, []);

  return (
    <>
      <style>{css}</style>
      <div
        ref={ref} style={{
          "--c1": "#f29e4c",
          "--c2": "#1f6f8b",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <button type="button" className="uvq07-pol" aria-pressed="false"><span className="fr"><span className="ph" aria-hidden="true"><i className="sk"></i><i className="sn"></i><i className="se"></i><i className="sa"></i><i className="dv"></i></span><span className="cp">Cádiz, August</span></span><span className="hn"><span className="h1">Tap to develop</span><span className="h2">Tap again to repeat</span></span></button>
      </div>
    </>
  );
}
```

Give me the complete final code, ready to paste, and tell me in one line where to put it in my project.
````
