Skip to content

Shenrui-Ma/video-regen-recipes / templates/drawing-process/svg-redraw-comparison

svg-redraw-comparison

Unverified

用参考图制作高精度 SVG 临摹绘制过程视频,交付纯 SVG 网页、独立 SVG 和原图对照 MP4。禁止 Canvas、位图嵌入与外链,按构图、线稿、固有色、阴影、高光、细节重放;横图上下、竖图左右合成。

FileKindSize
LICENSEother1.1 KB
LICENSES.mdmarkdown998 B
README.mdmarkdown2.5 KB
SKILL.mdskill md3.8 KB
assets/manifest.jsonconfig320 B
assets/reference.pngbinary2.7 MB
examples/demo.htmlother30.1 KB
examples/foundations.svgother597.0 KB
examples/preview.mp4binary3.2 MB
examples/redraw.svgother15.6 MB
examples/regions.jsonconfig6.7 KB
examples/validation.jsonconfig2.1 KB
profile.jsonconfig2.2 KB
prompts/author-original.prompt.txtmarkdown1.2 KB
prompts/redraw.prompt.txtmarkdown1.2 KB
references/validation.mdmarkdown1.2 KB
references/workflow.mdmarkdown5.0 KB
scripts/_contours.pyscript1.3 KB
scripts/_regions.pyscript1.2 KB
scripts/_validate_svg.pyscript1.5 KB
scripts/build_demo.pyscript5.9 KB
scripts/clean_png.pyscript2.1 KB
scripts/export_video.cjsscript6.1 KB
scripts/package_demo.pyscript3.4 KB
scripts/trace_reference.pyscript5.0 KB
sources.mdmarkdown1.7 KB
tests/check_player.cjsscript3.9 KB
tests/test_pipeline.pyscript4.2 KB
web/load-art.jsscript3.2 KB
web/player.cssother738 B
web/player.jsscript2.3 KB

web/load-art.js

View on GitHub
// Load fixed local vector data, then reconstruct the original semantic batches.
async function loadArt(){
 const status=document.getElementById('load-status'),picker=document.getElementById('svg-files');
 const expected=JSON.parse(document.getElementById('art-manifest').textContent);
 const ns='http://www.w3.org/2000/svg';
 async function parse(bytes,name){
  const hash=[...new Uint8Array(await crypto.subtle.digest('SHA-256',bytes))].map(x=>x.toString(16).padStart(2,'0')).join('');
  if(hash!==expected[name])throw Error('SVG 文件与此 Demo 不匹配:'+name);
  const doc=new DOMParser().parseFromString(new TextDecoder().decode(bytes),'image/svg+xml');
  if(doc.querySelector('parsererror'))throw Error('SVG 无法解析');
  const tags=new Set(['svg','g','path','polygon']);
  const attrs=new Set(['id','class','xmlns','viewBox','width','height','role','aria-label','data-region','data-order','opacity','shape-rendering','fill-rule','fill','d','points','stroke','stroke-width']);
  for(const el of doc.querySelectorAll('*')){
   if(el.namespaceURI!==ns||!tags.has(el.localName))throw Error('SVG 含有不支持的元素');
   for(const a of el.attributes)if(!attrs.has(a.name)||/url\s*\(/i.test(a.value))throw Error('SVG 含有不支持的属性');
  }
  return doc.documentElement;
 }
 let files;
 if(location.protocol==='file:'){
  status.textContent='选择同目录的 redraw.svg 和 foundations.svg 后即可离线播放。';picker.hidden=false;
  files=await new Promise(resolve=>{picker.onchange=()=>resolve(new Map([...picker.files].map(f=>[f.name,f])));});
 }
 const roots={};
 for(const name of ['foundations.svg','redraw.svg']){
  let bytes;
  if(files){if(!files.has(name))throw Error('请同时选择两个 SVG 文件,刷新页面后重试。');bytes=await files.get(name).arrayBuffer();}
  else {const response=await fetch(name);if(!response.ok)throw Error('无法读取 '+name);bytes=await response.arrayBuffer();}
  roots[name]=await parse(bytes,name);
 }
 const art=roots['foundations.svg'],complete=roots['redraw.svg'];
 if(art.getAttribute('viewBox')!==complete.getAttribute('viewBox'))throw Error('SVG 画幅不一致');
 const final=document.createElementNS(ns,'g');final.id='final-contours';final.setAttribute('shape-rendering','crispEdges');final.setAttribute('fill-rule','evenodd');
 const regions=[...complete.querySelector('#complete-vector-art').children];
 for(const phase of ['shadow','highlight','detail']){
  for(const region of regions){
   const name=region.getAttribute('data-region');
   const labels=expected.stages[name];if(!labels||labels.length!==region.children.length)throw Error('区域阶段索引不匹配');
   const paths=[...region.children].filter((p,i)=>labels[i]===phase[0]);
   for(let offset=0;offset<paths.length;offset+=64){
    const group=document.createElementNS(ns,'g');group.id=phase+'-'+name+'-'+offset/64;group.setAttribute('class','paint-step');group.dataset.stage=phase;group.dataset.region=name;
    for(const p of paths.slice(offset,offset+64))group.appendChild(p.cloneNode(true));final.appendChild(group);
   }
  }
 }
 art.appendChild(final);document.querySelector('.frame').replaceChildren(document.importNode(art,true));
 picker.hidden=true;status.textContent='本地 SVG 已加载';
}
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall