[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6EFE413WPEVSMPWJQ4MNJHZ":3,"skill-same:01M6EFE413WPEVSMPWJQ4MNJHZ":58},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":17,"categories":18,"keywords":29,"publishedAt":31,"linkOnly":32,"markdownContent":33,"markdownBody":33,"frontMatter":34,"refName":35,"commitSha":36,"skillDirectory":37,"forksCount":38,"repositoryHtmlUrl":39,"repositoryHomepageUrl":40,"ownerHtmlUrl":41,"ownerBlogUrl":7,"ownerDescription":42,"updatedAt":43,"install":44,"resources":57},"01M6EFE413WPEVSMPWJQ4MNJHZ","lottie","Lottie 矢量动画集成",null,"","ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FTerminalSkills\u002Fskills\u002Flottie\u002FSKILL.md",[19,24],{"categoryNo":20,"categoryName":21,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8CB2XXY3GHXAAXCJVKMGB72","动态图形与动效制作","SCENARIO","使用场景",{"categoryNo":25,"categoryName":26,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8CB2XYVYMMRS9AY3TYJW8B8","动效设计师","PROFESSION","适用职业",[30],"Lottie","2026-11-10 10:12:30",false,"# Lottie\n\nRender After Effects animations exported as JSON. Lightweight, scalable, and interactive.\n\n## Setup\n\n```bash\n# Install lottie-web for vanilla JS\u002FTS projects.\nnpm install lottie-web\n```\n\n## Basic Playback\n\n```typescript\n\u002F\u002F src\u002Flottie\u002Fplayer.ts — Load and play a Lottie animation in a DOM container.\n\u002F\u002F The animation JSON is typically exported from After Effects via Bodymovin.\nimport lottie, { AnimationItem } from \"lottie-web\";\n\nexport function playAnimation(\n  container: HTMLElement,\n  animationData: object\n): AnimationItem {\n  return lottie.loadAnimation({\n    container,\n    renderer: \"svg\", \u002F\u002F \"canvas\" or \"html\" also available\n    loop: true,\n    autoplay: true,\n    animationData,\n  });\n}\n\n\u002F\u002F Load from URL instead of inline data\nexport function playFromUrl(container: HTMLElement, path: string): AnimationItem {\n  return lottie.loadAnimation({\n    container,\n    renderer: \"svg\",\n    loop: true,\n    autoplay: true,\n    path, \u002F\u002F URL to the JSON file\n  });\n}\n```\n\n## Playback Controls\n\n```typescript\n\u002F\u002F src\u002Flottie\u002Fcontrols.ts — Control animation playback: play, pause, seek, speed.\nimport type { AnimationItem } from \"lottie-web\";\n\nexport function setupControls(anim: AnimationItem) {\n  \u002F\u002F Play \u002F Pause\n  anim.play();\n  anim.pause();\n  anim.stop();\n\n  \u002F\u002F Go to specific frame (frame 30, and play)\n  anim.goToAndPlay(30, true);\n\n  \u002F\u002F Go to specific frame and stop\n  anim.goToAndStop(0, true);\n\n  \u002F\u002F Playback speed (2x)\n  anim.setSpeed(2);\n\n  \u002F\u002F Play direction (-1 = reverse)\n  anim.setDirection(-1);\n\n  \u002F\u002F Play only a segment (frames 10-50)\n  anim.playSegments([10, 50], true);\n}\n```\n\n## Event Handling\n\n```typescript\n\u002F\u002F src\u002Flottie\u002Fevents.ts — Listen to animation lifecycle events for triggering\n\u002F\u002F UI updates, chaining animations, or tracking analytics.\nimport type { AnimationItem } from \"lottie-web\";\n\nexport function attachEvents(anim: AnimationItem) {\n  anim.addEventListener(\"complete\", () => {\n    console.log(\"Animation completed\");\n  });\n\n  anim.addEventListener(\"loopComplete\", () => {\n    console.log(\"Loop finished\");\n  });\n\n  anim.addEventListener(\"enterFrame\", (e) => {\n    \u002F\u002F Fires every frame — use sparingly\n    const progress = (e as any).currentTime \u002F anim.totalFrames;\n    document.getElementById(\"progress\")!.style.width = `${progress * 100}%`;\n  });\n\n  anim.addEventListener(\"DOMLoaded\", () => {\n    console.log(\"Animation DOM elements ready\");\n  });\n}\n```\n\n## React Integration\n\n```tsx\n\u002F\u002F src\u002Fcomponents\u002FLottiePlayer.tsx — React component wrapping lottie-web.\n\u002F\u002F Handles cleanup on unmount and exposes ref for external control.\nimport { useEffect, useRef } from \"react\";\nimport lottie, { AnimationItem } from \"lottie-web\";\n\ninterface Props {\n  animationData: object;\n  loop?: boolean;\n  autoplay?: boolean;\n  className?: string;\n}\n\nexport function LottiePlayer({ animationData, loop = true, autoplay = true, className }: Props) {\n  const containerRef = useRef\u003CHTMLDivElement>(null);\n  const animRef = useRef\u003CAnimationItem | null>(null);\n\n  useEffect(() => {\n    if (!containerRef.current) return;\n\n    animRef.current = lottie.loadAnimation({\n      container: containerRef.current,\n      renderer: \"svg\",\n      loop,\n      autoplay,\n      animationData,\n    });\n\n    return () => {\n      animRef.current?.destroy();\n    };\n  }, [animationData, loop, autoplay]);\n\n  return \u003Cdiv ref={containerRef} className={className} \u002F>;\n}\n```\n\n## Dynamic Color Updates\n\n```typescript\n\u002F\u002F src\u002Flottie\u002Ftheme.ts — Modify colors inside a Lottie JSON before rendering.\n\u002F\u002F Useful for theming animations to match brand colors at runtime.\nexport function recolorAnimation(\n  animationData: any,\n  colorMap: Record\u003Cstring, [number, number, number]>\n): any {\n  const data = JSON.parse(JSON.stringify(animationData));\n\n  function walkShapes(shapes: any[]) {\n    for (const shape of shapes) {\n      if (shape.ty === \"fl\" && shape.c?.k) {\n        const hex = rgbToHex(shape.c.k[0], shape.c.k[1], shape.c.k[2]);\n        if (colorMap[hex]) {\n          const [r, g, b] = colorMap[hex];\n          shape.c.k = [r, g, b, 1];\n        }\n      }\n      if (shape.it) walkShapes(shape.it);\n    }\n  }\n\n  for (const layer of data.layers || []) {\n    if (layer.shapes) walkShapes(layer.shapes);\n  }\n\n  return data;\n}\n\nfunction rgbToHex(r: number, g: number, b: number): string {\n  return \"#\" + [r, g, b].map((v) => Math.round(v * 255).toString(16).padStart(2, \"0\")).join(\"\");\n}\n```\n",{},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002FTerminalSkills\u002Fskills\u002Flottie",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":9,"skillName":5,"commands":45,"prompt":55,"zipAvailable":56},[46,49,52],{"tool":47,"command":48},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill lottie",{"tool":50,"command":51},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill lottie",{"tool":53,"command":54},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill lottie","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FTerminalSkills\u002Fskills\u002Flottie\u002FSKILL.md",true,[],[59,68,77,86,92,98],{"skillNo":60,"name":61,"nameZh":7,"description":7,"descriptionZh":7,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":31},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[],[65,66,67],"model","model hierarchy","model hierarchy skill",{"skillNo":69,"name":70,"nameZh":7,"description":7,"descriptionZh":7,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":31},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[],[74,75,76],"MCP","zoom","zoom mcp",{"skillNo":78,"name":79,"nameZh":7,"description":7,"descriptionZh":7,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":31},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[83,84,85,75],"sdk","zoom apps sdk","apps",{"skillNo":87,"name":88,"nameZh":7,"description":7,"descriptionZh":7,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":31},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[88],{"skillNo":93,"name":94,"nameZh":7,"description":7,"descriptionZh":7,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":31},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[],[94],{"skillNo":99,"name":100,"nameZh":7,"description":7,"descriptionZh":7,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":31},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[100]]