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

tests/check_player.cjs

View on GitHub
const assert=require('node:assert/strict'),path=require('node:path'),crypto=require('node:crypto'),{pathToFileURL}=require('node:url'),fs=require('node:fs'),http=require('node:http');
const {chromium}=require('playwright');
(async()=>{const b=await chromium.launch({headless:true,...(process.env.CHROMIUM_EXECUTABLE?{executablePath:process.env.CHROMIUM_EXECUTABLE}:{})});try{
 const page=await b.newPage({viewport:{width:1536,height:1200},deviceScaleFactor:1}),external=[];page.on('request',r=>{if(!r.url().startsWith('file:'))external.push(r.url());});
 const demo=path.resolve(process.env.DEMO_HTML||path.join(__dirname,'../examples/demo.html'));
 await page.goto(pathToFileURL(demo).href);
 if(await page.locator('#svg-files').count())await page.locator('#svg-files').setInputFiles(['redraw.svg','foundations.svg'].map(name=>path.join(path.dirname(demo),name)));
 await page.waitForFunction(()=>window.replay,{},{timeout:120000});
 assert.equal(await page.locator('canvas,img,image,foreignObject,script[src]').count(),0);
 const captureStyle='svg{position:fixed!important;top:0!important;left:0!important;width:1536px!important;height:1024px!important;background:white!important;z-index:99!important}';
 const style=await page.addStyleTag({content:captureStyle});
 const hashes=[];
 for(const t of [0,6,12,24,40,6]){await page.evaluate(t=>window.replay.renderAt(t),t);const bytes=await page.locator('svg').screenshot({timeout:120000});hashes.push(crypto.createHash('sha256').update(bytes).digest('hex'));}
 assert.equal(hashes[1],hashes[5]);assert.equal(new Set(hashes.slice(0,5)).size,5);assert.deepEqual(external,[]);
 await style.evaluate(e=>e.remove());
 await page.locator('#reset').click();await page.locator('#play').click();await page.waitForFunction(()=>Number(document.querySelector('#slider').value)>.1);await page.locator('#play').click();assert.equal(await page.locator('#play').textContent(),'播放');
 if(fs.existsSync(path.join(path.dirname(demo),'foundations.svg'))){
  const server=http.createServer((req,res)=>{
   const name=req.url.slice(1);if(!['demo.html','redraw.svg','foundations.svg'].includes(name)){res.writeHead(404);return res.end();}
   res.setHeader('Content-Type',name.endsWith('.svg')?'image/svg+xml':'text/html; charset=utf-8');fs.createReadStream(path.join(path.dirname(demo),name)).pipe(res);
  });
  await new Promise(resolve=>server.listen(0,'127.0.0.1',resolve));
  try{await page.goto(`http://127.0.0.1:${server.address().port}/demo.html`);await page.waitForFunction(()=>window.replay,{},{timeout:120000});assert.equal(await page.locator('#svg-files').isHidden(),true);}
  finally{await new Promise(resolve=>server.close(resolve));}
  await page.goto(pathToFileURL(demo).href);
  await page.locator('#svg-files').setInputFiles([{name:'redraw.svg',mimeType:'image/svg+xml',buffer:Buffer.from('wrong vector')},{name:'foundations.svg',mimeType:'image/svg+xml',buffer:fs.readFileSync(path.join(path.dirname(demo),'foundations.svg'))}]);
  await page.waitForFunction(()=>document.body.dataset.error==='true');assert.equal(await page.evaluate(()=>!!window.replay),false);
  console.log('PASS: HTTP automatic loading and mismatched-file rejection.');
 }
 if(process.env.OLD_DEMO_HTML){
  await page.goto(pathToFileURL(path.resolve(process.env.OLD_DEMO_HTML)).href);await page.waitForFunction(()=>window.replay);
  await page.addStyleTag({content:captureStyle});
  for(const [i,t] of [0,6,12,24,40].entries()){
   await page.evaluate(t=>window.replay.renderAt(t),t);
   const png=await page.locator('svg').screenshot({timeout:120000});
   assert.equal(crypto.createHash('sha256').update(png).digest('hex'),hashes[i],`Changed image at ${t}s`);
  }
  console.log('PASS: all five stages are pixel-identical to the previous inline demo.');
 }
 console.log('PASS: native SVG only, distinct painting stages, deterministic seek, offline playback and controls.');
}finally{await b.close();}})().catch(e=>{console.error(e.message);process.exitCode=1});
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