Skip to content

The open-source full-stack studio for Opus 5.5 motion video. Reverse engineering for any video. Code video with HTML: recreate, edit and render. BYOA + BYOK · Motion.md · Images, Video, Music & Voice.

15.9 KB
Raw Blame
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Paperwing · drawing an identity</title>
  <script src="assets/gsap.min.js"></script>
  <style>
    html, body { margin: 0; width: 1280px; height: 720px; overflow: hidden; }
    #film { --paper: #ffefab; --ink: #251930; color: var(--ink); background: var(--paper); }
    svg { display: block; width: 1280px; height: 720px; }
    .wing, .cap { fill: currentColor; }
    .stem { fill: none; stroke: currentColor; stroke-width: 16; }
    .wire { fill: none; stroke: #a39bb2; stroke-width: .9; }
    .point { fill: white; stroke: #5283ed; stroke-width: 1.4; }
    .lever { stroke: #f83255; stroke-width: 1.6; fill: #f83255; }
  </style>
</head>
<body>
  <main id="film" data-composition-id="main" data-start="0" data-duration="12" data-fps="24" data-width="1280" data-height="720">
    <svg id="paperwing-vector" class="clip" data-start="0" data-duration="5.1666666667" data-track-index="0" viewBox="0 0 640 360" aria-label="Four circles open into the Paperwing butterfly. Vector handles reshape its wing and antenna.">
      <defs>
        <pattern id="hatch" width="4" height="4" patternUnits="userSpaceOnUse" patternTransform="rotate(35)"><line x2="0" y2="4" stroke="#8494d5" stroke-width="1.4"/></pattern>
        <g id="half"><path class="wing" id="upper"/><path class="wing" id="lower"/></g>
      </defs>
      <g id="camera">
        <g id="art">
          <use href="#half" transform="translate(640 0) scale(-1 1)"/>
          <use href="#half"/>
          <path id="stem-left" class="stem"/><path id="stem-right" class="stem"/>
          <circle id="cap" class="cap" r="0"/>
          <g id="selection"><path id="hatching" fill="url(#hatch)"/><path id="wing-outline" class="wire"/>
            <g id="anchors"></g></g>
          <path id="cut" fill="var(--paper)"/>
          <g id="cut-tool"><path id="cut-guide" class="wire"/><g id="cut-points"></g></g>
          <g id="width-tool"><path id="centerline" class="wire"/><circle id="tip" class="point" r="2.5"/>
            <g id="handles" class="lever"><path d="M0 -14v28"/><circle cy="-14" r="1.8"/><circle cy="14" r="1.8"/></g>
          </g>
        </g>
      </g>
      <g id="detail" opacity="0">
        <path fill="currentColor" d="M0 72 L23 72 Q123 180 155 305 Q206 211 305 177 C405 141 538 178 574 272 Q579 288 579 310 C509 250 473 278 469 360 H0 Z"/>
        <path id="close-stem" fill="currentColor"/>
        <path d="M165 360 Q208 171 418 93" fill="none" stroke="#bab5c3" stroke-width="1.8"/>
        <circle cx="418" cy="93" r="8" fill="white" stroke="#4b96f5" stroke-width="3.5"/>
        <g id="close-tip" stroke="#f32f53" fill="#f32f53" stroke-width="3">
          <path d="M359 55l38 100"/><circle cx="359" cy="55" r="6"/><circle cx="397" cy="155" r="6"/>
        </g>
        <g id="close-base" stroke="#f32f53" fill="#f32f53" stroke-width="3">
          <path d="M197 198l54 38"/><circle cx="197" cy="198" r="6"/><circle cx="251" cy="236" r="6"/>
        </g>
      </g>
    </svg>
    <svg id="poster-scene" class="clip" data-start="5.1666666667" data-duration="6.8333333333" data-track-index="1" viewBox="0 0 640 360" aria-label="Editable color fills, feathering controls and the full Wing Fest poster" style="position:absolute;inset:0;visibility:hidden">
      <defs>
        <linearGradient id="poster-paint" x1="80%" y1="15%" x2="40%" y2="100%">
          <stop stop-color="#6a5877"/><stop offset=".38" stop-color="#918196"/><stop offset=".63" stop-color="#ffed96"/><stop offset="1" stop-color="#c5aedf"/>
        </linearGradient>
        <linearGradient id="enamel" x2="0" y2="1" gradientUnits="objectBoundingBox" gradientTransform="rotate(-8 .5 .5)">
          <stop stop-color="#a4524b"/><stop offset=".2" stop-color="#f69c30"/><stop offset=".48" stop-color="#d54462"/><stop offset=".66" stop-color="#ea694c"/><stop offset="1" stop-color="#c6a7e2"/>
        </linearGradient>
        <radialGradient id="upper-inlay" cx=".25" cy=".5" r=".86"><stop stop-color="#ffec92"/><stop offset=".52" stop-color="#c6a7df"/><stop offset=".84" stop-color="#f68054"/><stop offset="1" stop-color="#d25070"/></radialGradient>
        <radialGradient id="lower-inlay" cx=".24" cy=".18" r=".86"><stop stop-color="#ffdf7d"/><stop offset=".56" stop-color="#f08b3b"/><stop offset="1" stop-color="#b84c74"/></radialGradient>
        <pattern id="pigment" width="28" height="28" patternUnits="userSpaceOnUse"><image id="grain-tile" width="28" height="28"/></pattern>
        <g id="painted-half">
          <path fill="url(#enamel)" d="M0 1 Q-9 -32 -38 -75 Q-55 -98 -74 -88 Q-91 -77 -78 -65 Q-69 -57 -53 -67 Q-25 -63 -9 -31 Q-34 -62 -77 -55 Q-101 -52 -101 -31 Q-94 -39 -83 -33 Q-77 -28 -76 -11 Q-74 2 -54 3 Q-20 5 -7 15 Q-20 25 -48 15 Q-81 5 -92 23 Q-106 45 -91 69 Q-76 94 -50 86 Q-24 79 -13 50 Q-4 27 0 24 Z"/>
          <path fill="url(#upper-inlay)" d="M-90 -42 Q-57 -68 -20 -39 Q-11 -31 -8 -23 Q-34 -45 -48 -39 Q-62 -34 -50 -27 Q-32 -20 -19 -24 Q-5 -26 -5 -8 Q-16 -17 -32 -15 Q-61 -13 -64 -23 Q-68 -44 -90 -42 Z"/>
          <ellipse fill="url(#upper-inlay)" cx="-42" cy="-11" rx="23" ry="9" transform="rotate(7 -42 -11)"/>
          <ellipse fill="#ffe263" cx="-89" cy="-42" rx="4" ry="5"/>
          <ellipse fill="url(#upper-inlay)" cx="-69" cy="-78" rx="8" ry="8"/>
          <path fill="url(#lower-inlay)" d="M-8 20 Q-20 18 -28 22 Q-40 24 -52 20 Q-68 14 -69 25 Q-70 35 -59 36 Q-51 33 -46 46 Q-41 56 -37 40 Q-32 27 -24 35 Q-15 42 -8 20 Z"/>
          <ellipse fill="url(#lower-inlay)" cx="-77" cy="40" rx="12" ry="22" transform="rotate(25 -77 40)"/>
          <ellipse fill="url(#lower-inlay)" cx="-56" cy="63" rx="7" ry="14" transform="rotate(22 -56 63)"/>
          <ellipse fill="url(#lower-inlay)" cx="-40" cy="63" rx="4" ry="8"/>
        </g>
        <clipPath id="wing-mask"><use href="#painted-half"/><use href="#painted-half" transform="scale(-1 1)"/></clipPath>
      </defs>
      <rect width="640" height="360" fill="#492e47"/>
      <g id="poster-camera">
        <rect x="139" y="15" width="362" height="413" rx="5" fill="#ebe2d4"/>
        <rect x="139" y="28" width="362" height="246" fill="url(#poster-paint)"/>
        <rect id="poster-paper" x="139" y="28" width="362" height="246" fill="#ffefab"/>
        <rect x="139" y="15" width="362" height="13" rx="2" fill="#e67854"/>
        <g font-family="Helvetica Neue,Arial,sans-serif" font-weight="700">
          <text x="320" y="23" text-anchor="middle" font-size="4.7">Paperwing presents a field guide to color, form and motion</text>
          <g id="poster-type" fill="#ffec89">
            <text x="153" y="75" font-size="43" letter-spacing="-2.5">WING</text><text x="153" y="113" font-size="43" letter-spacing="-2.5">FEST</text>
            <text x="151" y="151" font-size="10" fill="#4b3c51">PAPERWING</text><text x="151" y="162" font-size="10" fill="#4b3c51">STUDIO</text>
            <text x="462" y="52" font-size="6">Program</text><text x="462" y="63" font-size="6">Artists</text><text x="462" y="74" font-size="6">About</text>
          </g>
          <g fill="#483e48" font-size="9"><text x="153" y="330">Studies</text><text x="220" y="344">Wings</text><text x="312" y="344">Ink</text><text x="404" y="344">Motion</text></g>
        </g>
        <g font-family="Arial,sans-serif" font-size="3.5" fill="#594e58">
          <text x="220" y="350">Contour, structure and flight</text><text x="220" y="356">A field guide to illustration</text>
          <text x="312" y="350">Color studies in motion</text><text x="312" y="356">Experiments from the studio</text>
          <text x="404" y="350">Live drawing and workshops</text><text x="404" y="356">Open studio program</text>
        </g>
        <path d="M218 322h82m9 0h82m9 0h82" stroke="#877a81" stroke-width=".6"/>
        <g id="enamel-wings" transform="translate(320 161)">
          <use href="#painted-half"/><use href="#painted-half" transform="scale(-1 1)"/>
          <rect x="-103" y="-92" width="206" height="182" clip-path="url(#wing-mask)" fill="url(#pigment)" opacity=".64"/>
        </g>
        <g id="color-nodes" fill="#fff" stroke="#5589dc" stroke-width=".6">
          <path d="M320 171 Q343 192 367 177 Q395 161 409 187 Q432 220 402 240 Q363 269 340 226 Q330 204 320 171Z" fill="none"/>
        </g>
        <g id="lower-box" fill="none" stroke="#6f98ea" stroke-width=".65">
          <rect x="320" y="169" width="100" height="82"/>
          <g fill="#fff"><rect x="319" y="168" width="2" height="2"/><rect x="419" y="168" width="2" height="2"/><rect x="319" y="250" width="2" height="2"/><rect x="419" y="250" width="2" height="2"/></g>
        </g>
      </g>
      <g id="paint-dial" font-family="Helvetica Neue,Arial" fill="#251930"><rect x="42" y="108" rx="5" width="147" height="153" fill="#fffcf5" stroke="#d8ced8"/>
        <text x="55" y="130" font-size="12" font-weight="700">Paint</text>
        <path d="M55 139h119m-119 38h119m-119 37h119" stroke="#d8cfce"/>
        <text x="55" y="162" font-size="9">Fill</text><text x="108" y="162" font-size="9">Enamel</text>
        <text x="55" y="197" font-size="9">Blur</text><path d="M104 194h65" stroke="#c5b5bd" stroke-width="3"/>
        <g fill="#827887" font-size="8">
          <text x="164" y="159">⌄</text><text x="165" y="235">⌄</text><text x="64" y="250" font-size="6">COLOR EFFECTS</text>
        </g>
        <rect x="94" y="154" width="8" height="8" rx="2" fill="url(#enamel)"/>
        <circle id="paint-knob" cx="109" cy="194" r="4" fill="#886bc6"/>
        <text x="55" y="235" font-size="9">Grain</text><text x="142" y="235" font-size="9">12%</text>
      </g>
      <rect id="press-grain" width="640" height="360" fill="url(#pigment)" opacity=".16"/>
    </svg>
    <audio id="score" class="clip" data-start="0" data-duration="12" data-track-index="2" src="assets/score.m4a"></audio>
  </main>
  <script>
    const el = id => document.getElementById(id);
    const path = (id, d) => el(id).setAttribute('d', d);
    const point = (node,x,y) => { node.setAttribute('cx',x); node.setAttribute('cy',y); };
    function dots(id, pts) {
      const nodes = pts.map(([x,y]) => {
        const n = document.createElementNS('http://www.w3.org/2000/svg','circle');
        n.setAttribute('class','point'); n.setAttribute('r','2.1'); point(n,x,y); return n;
      });
      el(id).replaceChildren(...nodes);
    }
    function circle(x,y,r) {
      const k = r*.5523;
      return [x-r,y, x-r,y-k,x-k,y-r,x,y-r, x+k,y-r,x+r,y-k,x+r,y,
        x+r,y+k,x+k,y+r,x,y+r, x-k,y+r,x-r,y+k,x-r,y];
    }
    const upperWing = [320,163, 337,101,383,54,439,68, 487,70,512,112,485,154,
      468,179,446,194,425,203, 382,223,323,208,320,163];
    const lowerWing = [320,164, 344,170,398,184,425,201, 473,218,491,270,449,306,
      402,336,352,312,329,275, 320,259,317,208,320,164];
    const upperSeed = circle(355,145,31), lowerSeed = circle(355,215,31);
    function contour(seed,target,mix){
      const a=seed.map((v,i)=>(v+(target[i]-v)*mix).toFixed(2));
      return 'M'+a.slice(0,2).join(' ')+' C'+a.slice(2).join(' ')+' Z';
    }
    const scallop = 'M497 109 C451 84 452 134 444 152 C432 189 405 191 361 183 C320 176 314 218 351 219 C393 219 400 193 431 207 L476 238 L515 184 Z';
    const cutNodes = [[497,109],[445,151],[359,183],[326,201],[350,219],[428,202]];
    dots('anchors',[[320,151],[373,79],[487,99],[499,116],[427,201],[471,249],[468,277],[371,314],[320,247]]);
    dots('cut-points',cutNodes);
    const s = {spread:0, stems:0, scale:1, hatch:0, guides:0, outline:0, cut:0, zoom:0, width:0, handle:0, detail:0, upperHatch:0};
    function draw(){
      const up=contour(upperSeed,upperWing,s.spread), down=contour(lowerSeed,lowerWing,s.spread);
      path('upper',up); path('lower',down); path('hatching',(s.upperHatch>.5?up:'')+' '+down); path('wing-outline',up+' '+down);
      const tipX=328+52*s.stems, tipY=142-116*s.stems;
      path('stem-right',`M319 160 Q323 ${137-42*s.stems} ${tipX} ${tipY}`);
      path('stem-left',`M321 160 Q317 ${137-42*s.stems} ${640-tipX} ${tipY}`);
      el('stem-left').style.opacity=el('stem-right').style.opacity=s.stems;
      point(el('cap'),tipX,tipY); el('cap').setAttribute('r',s.width*14);
      el('art').setAttribute('transform',`translate(320 180) scale(${s.scale}) translate(-320 -180)`);
      const z=1+3.2*s.zoom;
      el('camera').setAttribute('transform',`translate(${-1178*s.zoom} ${-16*s.zoom}) scale(${z})`);
      el('hatching').style.opacity=s.hatch; el('selection').style.opacity=s.guides;
      path('cut',scallop); path('cut-guide',scallop); el('cut-tool').style.opacity=s.outline;
      el('cut').style.opacity=s.cut;
      el('detail').style.opacity=s.detail; el('camera').style.opacity=1-s.detail;
      path('close-stem',`M155 310 C186 200 268 ${117-37*s.width} ${398-8*s.width} ${76-34*s.width} C${444+18*s.width} ${57-45*s.width} ${459+29*s.width} ${116+27*s.width} ${414+7*s.width} ${123+25*s.width} Q226 ${183-5*s.width} 166 360 L149 360 Z`);
      el('close-tip').style.opacity=s.width; el('close-base').style.opacity=s.handle;
      el('width-tool').style.opacity=s.zoom; path('centerline',`M320 136 Q327 54 ${tipX} ${tipY}`);
      point(el('tip'),tipX,tipY);
      el('handles').setAttribute('transform',`translate(${tipX-9-19*s.handle} ${tipY+4+14*s.handle}) rotate(${-17-23*s.handle}) scale(${s.width||.01})`);
    }
    draw();
    const tl=gsap.timeline({paused:true,onUpdate:draw});
    function change(at, duration, values){tl.to(s,{...values,duration,ease:'power2.inOut'},at);}
    change(0,.15,{scale:.95}); change(.34,.46,{spread:.36,stems:.64}); change(.81,.39,{spread:1,stems:1});
    change(1.05,.14,{guides:1}); change(1.39,.22,{scale:1,hatch:1}); change(1.76,.09,{upperHatch:1}); change(1.99,.10,{hatch:0});
    change(2.22,.26,{outline:1}); change(3.21,.09,{cut:1,guides:0,outline:0});
    change(3.65,.20,{zoom:1}); change(3.76,.09,{detail:1}); change(4.14,.20,{width:1}); change(4.52,.43,{handle:1});
    const contourNodes=[[320,171],[341,181],[357,181],[367,177],[389,173],[404,182],[413,196],[416,215],[407,236],[391,245],[372,249],[353,241],[340,226],[333,210],[328,190]];
    for(const [x,y] of contourNodes){
      const handle=document.createElementNS('http://www.w3.org/2000/svg','circle');
      point(handle,x,y);handle.setAttribute('r','1.15');el('color-nodes').append(handle);
    }
    // A repeating pigment texture is generated from a fixed seed so each export is deterministic.
    const tile=document.createElement('canvas'); tile.width=tile.height=96;
    const texture=tile.getContext('2d'), specks=texture.createImageData(96,96);
    let pigmentSeed=517;
    for(let i=0;i<specks.data.length;i+=4){
      pigmentSeed=(Math.imul(pigmentSeed,1664525)+1013904223)>>>0;
      const light=(pigmentSeed & 1)?255:14;
      specks.data.set([light,light,light,((pigmentSeed>>>16)&127)],i);
    }
    texture.putImageData(specks,0,0);el('grain-tile').setAttribute('href',tile.toDataURL());
    const poster = el('poster-scene'), posterCamera = el('poster-camera');
    const paint = {scale:2.95, cx:365, cy:212, box:0, paper:1, type:0, dial:0, knob:0};
    function repaint() {
      posterCamera.setAttribute('transform', 'translate(320 180) scale('+paint.scale+') translate('+(-paint.cx)+' '+(-paint.cy)+')');
      el('color-nodes').style.opacity=paint.scale>3?0:Math.max(paint.box,(paint.paper>.88?1:0));el('lower-box').style.opacity=paint.box;el('poster-paper').style.opacity=paint.paper;
      el('poster-type').style.opacity=paint.type;el('paint-dial').style.opacity=paint.dial;
      el('paint-knob').setAttribute('cx',109+paint.knob*48);
    }
    function paintTo(at,duration,values){tl.to(paint,{...values,duration,ease:'power2.inOut',onUpdate:repaint},at);}
    repaint();
    tl.set(poster,{visibility:'visible'},5.1666666667);
    paintTo(5.18,.68,{scale:2.85,cx:365,cy:207,box:1});
    paintTo(6.15,.65,{paper:0});
    paintTo(6.91,.18,{scale:4.1,cx:371,cy:119,box:0});
    paintTo(7.32,.20,{dial:1});paintTo(7.88,.46,{knob:.85});paintTo(8.87,.54,{knob:.38});
    paintTo(9.48,.36,{type:1});paintTo(9.76,.36,{dial:0});
    paintTo(10.02,1.65,{scale:1,cx:320,cy:180});
    tl.set({}, {}, 12);

    window.__timelines={main:tl};
  </script>
</body>
</html>