dsh-drawai 0.3.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +4142 -0
- package/README.md +43 -10
- package/lib/audio-media.js +147 -0
- package/lib/audio-service.js +66 -0
- package/lib/canvas-format.js +134 -0
- package/lib/client.js +5283 -223
- package/lib/comfyui-default-workflow.mjs +1825 -0
- package/lib/comfyui-workflow.mjs +426 -0
- package/lib/document-commands.js +12 -0
- package/lib/document-core.js +29 -0
- package/lib/drawing-tasks.js +26 -0
- package/lib/imagegen.mjs +596 -0
- package/lib/index.js +1758 -129
- package/lib/media.js +26 -13
- package/lib/mgstyle-core.js +75 -0
- package/lib/motion/apply.js +180 -0
- package/lib/motion/asset-pack-lock.js +10 -0
- package/lib/motion/asset-pack.js +335 -0
- package/lib/motion/assets.js +290 -0
- package/lib/motion/audio.js +103 -0
- package/lib/motion/audiolevel.js +63 -0
- package/lib/motion/audiomix.js +144 -0
- package/lib/motion/beats.js +337 -0
- package/lib/motion/builtin-assets.js +62 -0
- package/lib/motion/canvas-spec.js +442 -0
- package/lib/motion/capture.js +95 -0
- package/lib/motion/cards.js +80 -0
- package/lib/motion/collect.js +447 -0
- package/lib/motion/delivery.js +112 -0
- package/lib/motion/edge-speech.py +90 -0
- package/lib/motion/entry.jsx +73 -0
- package/lib/motion/export.js +200 -0
- package/lib/motion/ffmpeg.js +42 -0
- package/lib/motion/fonts.js +71 -0
- package/lib/motion/jobs.js +113 -0
- package/lib/motion/json.js +4 -0
- package/lib/motion/media-catalog.js +59 -0
- package/lib/motion/mgstyles/BRIEF-TEMPLATE.md +63 -0
- package/lib/motion/mgstyles/briefs/01-flat-vector.md +104 -0
- package/lib/motion/mgstyles/briefs/02-line-art.md +97 -0
- package/lib/motion/mgstyles/briefs/03-isometric.md +108 -0
- package/lib/motion/mgstyles/briefs/05-cel-boil.md +145 -0
- package/lib/motion/mgstyles/briefs/06-collage.md +149 -0
- package/lib/motion/mgstyles/briefs/07-liquid.md +106 -0
- package/lib/motion/mgstyles/briefs/08-morph.md +111 -0
- package/lib/motion/mgstyles/briefs/09-bauhaus.md +150 -0
- package/lib/motion/mgstyles/briefs/10-synthwave.md +151 -0
- package/lib/motion/mgstyles/briefs/12-aurora-glass.md +147 -0
- package/lib/motion/mgstyles/briefs/18-hanazi.md +140 -0
- package/lib/motion/mgstyles/briefs/19-paperclip.md +156 -0
- package/lib/motion/mgstyles/briefs/20-pixel.md +118 -0
- package/lib/motion/mgstyles/briefs/22-hud.md +118 -0
- package/lib/motion/mgstyles/catalog.d/01-flat-vector.json +34 -0
- package/lib/motion/mgstyles/catalog.d/02-line-art.json +34 -0
- package/lib/motion/mgstyles/catalog.d/03-isometric.json +35 -0
- package/lib/motion/mgstyles/catalog.d/05-cel-boil.json +28 -0
- package/lib/motion/mgstyles/catalog.d/06-collage.json +28 -0
- package/lib/motion/mgstyles/catalog.d/07-liquid.json +28 -0
- package/lib/motion/mgstyles/catalog.d/08-morph.json +28 -0
- package/lib/motion/mgstyles/catalog.d/09-bauhaus.json +28 -0
- package/lib/motion/mgstyles/catalog.d/10-synthwave.json +28 -0
- package/lib/motion/mgstyles/catalog.d/12-aurora-glass.json +28 -0
- package/lib/motion/mgstyles/catalog.d/18-hanazi.json +28 -0
- package/lib/motion/mgstyles/catalog.d/19-paperclip.json +28 -0
- package/lib/motion/mgstyles/catalog.d/20-pixel.json +28 -0
- package/lib/motion/mgstyles/catalog.d/22-hud.json +28 -0
- package/lib/motion/mgstyles/catalog.json +1356 -0
- package/lib/motion/mgstyles/upstream/README.md +147 -0
- package/lib/motion/mgstyles/upstream/README.zh-CN.md +147 -0
- package/lib/motion/mgstyles/upstream/demos/01-flat-vector/cues.json +1 -0
- package/lib/motion/mgstyles/upstream/demos/01-flat-vector/index.html +712 -0
- package/lib/motion/mgstyles/upstream/demos/02-line-art/cues.json +331 -0
- package/lib/motion/mgstyles/upstream/demos/02-line-art/film.js +676 -0
- package/lib/motion/mgstyles/upstream/demos/02-line-art/index.html +18 -0
- package/lib/motion/mgstyles/upstream/demos/02-line-art/tools/dump_timing.mjs +26 -0
- package/lib/motion/mgstyles/upstream/demos/03-isometric/cues.json +109 -0
- package/lib/motion/mgstyles/upstream/demos/03-isometric/index.html +25 -0
- package/lib/motion/mgstyles/upstream/demos/03-isometric/js/anim.js +82 -0
- package/lib/motion/mgstyles/upstream/demos/03-isometric/js/main.js +219 -0
- package/lib/motion/mgstyles/upstream/demos/03-isometric/js/night5.js +180 -0
- package/lib/motion/mgstyles/upstream/demos/03-isometric/js/render.js +202 -0
- package/lib/motion/mgstyles/upstream/demos/03-isometric/js/title.js +167 -0
- package/lib/motion/mgstyles/upstream/demos/03-isometric/js/title5.js +294 -0
- package/lib/motion/mgstyles/upstream/demos/03-isometric/js/ui.js +141 -0
- package/lib/motion/mgstyles/upstream/demos/03-isometric/js/world.js +1399 -0
- package/lib/motion/mgstyles/upstream/demos/05-cel-boil/cues.json +157 -0
- package/lib/motion/mgstyles/upstream/demos/05-cel-boil/index.html +34 -0
- package/lib/motion/mgstyles/upstream/demos/05-cel-boil/js/engine.js +326 -0
- package/lib/motion/mgstyles/upstream/demos/05-cel-boil/js/scene.js +2036 -0
- package/lib/motion/mgstyles/upstream/demos/06-collage/assets/gen/layout.json +157 -0
- package/lib/motion/mgstyles/upstream/demos/06-collage/cues.json +80 -0
- package/lib/motion/mgstyles/upstream/demos/06-collage/index.html +889 -0
- package/lib/motion/mgstyles/upstream/demos/07-liquid/cues.json +100 -0
- package/lib/motion/mgstyles/upstream/demos/07-liquid/index.html +108 -0
- package/lib/motion/mgstyles/upstream/demos/07-liquid/js/engine.js +153 -0
- package/lib/motion/mgstyles/upstream/demos/07-liquid/js/links.js +64 -0
- package/lib/motion/mgstyles/upstream/demos/07-liquid/js/lookdev.js +46 -0
- package/lib/motion/mgstyles/upstream/demos/07-liquid/js/scene.js +963 -0
- package/lib/motion/mgstyles/upstream/demos/07-liquid/js/shaders.js +647 -0
- package/lib/motion/mgstyles/upstream/demos/07-liquid/js/textsdf.js +114 -0
- package/lib/motion/mgstyles/upstream/demos/07-liquid/js/type.js +50 -0
- package/lib/motion/mgstyles/upstream/demos/08-morph/cues.json +131 -0
- package/lib/motion/mgstyles/upstream/demos/08-morph/glyphs.json +1 -0
- package/lib/motion/mgstyles/upstream/demos/08-morph/index.html +901 -0
- package/lib/motion/mgstyles/upstream/demos/09-bauhaus/cues.json +270 -0
- package/lib/motion/mgstyles/upstream/demos/09-bauhaus/film.js +697 -0
- package/lib/motion/mgstyles/upstream/demos/09-bauhaus/index.html +12 -0
- package/lib/motion/mgstyles/upstream/demos/10-synthwave/cues.json +44 -0
- package/lib/motion/mgstyles/upstream/demos/10-synthwave/index.html +1028 -0
- package/lib/motion/mgstyles/upstream/demos/12-aurora-glass/cues.json +67 -0
- package/lib/motion/mgstyles/upstream/demos/12-aurora-glass/index.html +16 -0
- package/lib/motion/mgstyles/upstream/demos/12-aurora-glass/main.js +967 -0
- package/lib/motion/mgstyles/upstream/demos/12-aurora-glass/shaders.js +468 -0
- package/lib/motion/mgstyles/upstream/demos/18-hanazi/cues.json +117 -0
- package/lib/motion/mgstyles/upstream/demos/18-hanazi/index.html +541 -0
- package/lib/motion/mgstyles/upstream/demos/19-paperclip/assets/countries-110m.json +1 -0
- package/lib/motion/mgstyles/upstream/demos/19-paperclip/assets/stickers/meta.json +34 -0
- package/lib/motion/mgstyles/upstream/demos/19-paperclip/cues.json +285 -0
- package/lib/motion/mgstyles/upstream/demos/19-paperclip/index.html +599 -0
- package/lib/motion/mgstyles/upstream/demos/20-pixel/cues.json +42 -0
- package/lib/motion/mgstyles/upstream/demos/20-pixel/film.js +914 -0
- package/lib/motion/mgstyles/upstream/demos/20-pixel/index.html +18 -0
- package/lib/motion/mgstyles/upstream/demos/22-hud/cues.json +108 -0
- package/lib/motion/mgstyles/upstream/demos/22-hud/index.html +125 -0
- package/lib/motion/mgstyles/upstream/demos/22-hud/js/holo.js +275 -0
- package/lib/motion/mgstyles/upstream/demos/22-hud/js/hud.js +855 -0
- package/lib/motion/mgstyles/upstream/demos/22-hud/js/post.js +150 -0
- package/lib/motion/mgstyles/upstream/demos/22-hud/js/util.js +65 -0
- package/lib/motion/mgstyles/upstream/demos/22-hud/js/v5.js +142 -0
- package/lib/motion/mgstyles/upstream/harness/render.mjs +319 -0
- package/lib/motion/mgstyles/upstream/manifest.json +269 -0
- package/lib/motion/mgstyles/upstream/prompts/01-flat-vector.md +98 -0
- package/lib/motion/mgstyles/upstream/prompts/02-line-art.md +95 -0
- package/lib/motion/mgstyles/upstream/prompts/03-isometric.md +97 -0
- package/lib/motion/mgstyles/upstream/prompts/05-cel-boil.md +95 -0
- package/lib/motion/mgstyles/upstream/prompts/06-collage.md +95 -0
- package/lib/motion/mgstyles/upstream/prompts/07-liquid.md +98 -0
- package/lib/motion/mgstyles/upstream/prompts/08-morph.md +95 -0
- package/lib/motion/mgstyles/upstream/prompts/09-bauhaus.md +96 -0
- package/lib/motion/mgstyles/upstream/prompts/10-synthwave.md +95 -0
- package/lib/motion/mgstyles/upstream/prompts/12-aurora-glass.md +96 -0
- package/lib/motion/mgstyles/upstream/prompts/18-hanazi.md +95 -0
- package/lib/motion/mgstyles/upstream/prompts/19-paperclip.md +96 -0
- package/lib/motion/mgstyles/upstream/prompts/20-pixel.md +96 -0
- package/lib/motion/mgstyles/upstream/prompts/22-hud.md +95 -0
- package/lib/motion/mgstyles/upstream/rubric.md +51 -0
- package/lib/motion/mgstyles/upstream/template.md +36 -0
- package/lib/motion/pixelqa.js +198 -0
- package/lib/motion/preview.js +95 -0
- package/lib/motion/project.js +395 -0
- package/lib/motion/qa.js +290 -0
- package/lib/motion/reference-media.jsx +10 -0
- package/lib/motion/render-settings.js +112 -0
- package/lib/motion/render.js +159 -0
- package/lib/motion/scene-kit.js +183 -0
- package/lib/motion/sfx.js +232 -0
- package/lib/motion/shotcraft/ClipCard.tsx +204 -0
- package/lib/motion/shotcraft/catalog.json +2461 -0
- package/lib/motion/shotcraft/upstream/SKILL.md +286 -0
- package/lib/motion/shotcraft/upstream/assets/lib/Caption.tsx +54 -0
- package/lib/motion/shotcraft/upstream/assets/lib/ClipCard.tsx +200 -0
- package/lib/motion/shotcraft/upstream/assets/lib/DigitRoll.tsx +45 -0
- package/lib/motion/shotcraft/upstream/assets/lib/FlashCut.tsx +20 -0
- package/lib/motion/shotcraft/upstream/assets/lib/FlatPanel.tsx +65 -0
- package/lib/motion/shotcraft/upstream/assets/lib/PageCam.tsx +151 -0
- package/lib/motion/shotcraft/upstream/assets/lib/VerticalTicker.tsx +129 -0
- package/lib/motion/shotcraft/upstream/assets/lib/helpers/camera.tsx +75 -0
- package/lib/motion/shotcraft/upstream/assets/lib/helpers/motion.ts +40 -0
- package/lib/motion/shotcraft/upstream/assets/lib/helpers/rand.ts +11 -0
- package/lib/motion/shotcraft/upstream/assets/lib/helpers/shake.ts +10 -0
- package/lib/motion/shotcraft/upstream/assets/scripts/__pycache__/sfx-source.cpython-313.pyc +0 -0
- package/lib/motion/shotcraft/upstream/assets/scripts/build-readme-cover.mjs +49 -0
- package/lib/motion/shotcraft/upstream/assets/scripts/capture-template.mjs +210 -0
- package/lib/motion/shotcraft/upstream/assets/scripts/sfx-source.py +423 -0
- package/lib/motion/shotcraft/upstream/assets/scripts/smoke-render-demos.py +170 -0
- package/lib/motion/shotcraft/upstream/assets/scripts/test_sfx_source.py +157 -0
- package/lib/motion/shotcraft/upstream/demos/README.md +120 -0
- package/lib/motion/shotcraft/upstream/demos/_fixtures/Brand.tsx +112 -0
- package/lib/motion/shotcraft/upstream/demos/_fixtures/Fixtures.tsx +647 -0
- package/lib/motion/shotcraft/upstream/demos/_fixtures/Look.tsx +316 -0
- package/lib/motion/shotcraft/upstream/demos/_fixtures/Motion.tsx +82 -0
- package/lib/motion/shotcraft/upstream/demos/_fixtures/PageCam2D.tsx +115 -0
- package/lib/motion/shotcraft/upstream/demos/_fixtures/Polish.tsx +243 -0
- package/lib/motion/shotcraft/upstream/demos/_textures/live-layout.json +389 -0
- package/lib/motion/shotcraft/upstream/demos/camera/basic-3d-scene/Basic3DScene.tsx +250 -0
- package/lib/motion/shotcraft/upstream/demos/camera/crash-zoom-punch/CrashImpactReal.tsx +305 -0
- package/lib/motion/shotcraft/upstream/demos/camera/crash-zoom-punch/CrashZoomReal.tsx +246 -0
- package/lib/motion/shotcraft/upstream/demos/camera/cursor-flyover/CursorFlyover.tsx +390 -0
- package/lib/motion/shotcraft/upstream/demos/camera/depth-layer-moves/MultiplaneReal.tsx +138 -0
- package/lib/motion/shotcraft/upstream/demos/camera/graze-face-tour/GrazeFaceTour.tsx +542 -0
- package/lib/motion/shotcraft/upstream/demos/camera/overhead-camera-moves/OverheadTabletopDrop.tsx +315 -0
- package/lib/motion/shotcraft/upstream/demos/camera/overhead-camera-moves/TiltReveal.tsx +299 -0
- package/lib/motion/shotcraft/upstream/demos/camera/space-camera-moves/DroneDiveLanding.tsx +173 -0
- package/lib/motion/shotcraft/upstream/demos/camera/space-camera-moves/ExplodedView.tsx +348 -0
- package/lib/motion/shotcraft/upstream/demos/camera/steep-tilt-glide/SteepTiltGlide.tsx +366 -0
- package/lib/motion/shotcraft/upstream/demos/camera/tension-camera-moves/BulletTimeFreezeOrbit.tsx +279 -0
- package/lib/motion/shotcraft/upstream/demos/camera/tension-camera-moves/PullBackIsolation.tsx +184 -0
- package/lib/motion/shotcraft/upstream/demos/camera/terminal-3d/Terminal3D.tsx +390 -0
- package/lib/motion/shotcraft/upstream/demos/data/before-after-slider-scrub/BeforeAfterSliderScrub.tsx +155 -0
- package/lib/motion/shotcraft/upstream/demos/data/chart-live-moves/AxisRescaleShockV2.tsx +303 -0
- package/lib/motion/shotcraft/upstream/demos/data/chart-live-moves/OscilloscopeStreamV2.tsx +290 -0
- package/lib/motion/shotcraft/upstream/demos/data/chart-live-moves/UnitDotSwarmRegroupV2.tsx +278 -0
- package/lib/motion/shotcraft/upstream/demos/data/gauge-readout-moves/NeedleSweepSelftest.tsx +307 -0
- package/lib/motion/shotcraft/upstream/demos/data/gauge-readout-moves/TapeScrollFixedPointer.tsx +215 -0
- package/lib/motion/shotcraft/upstream/demos/data/scroll-brake-moves/BrakeReticleLock.tsx +299 -0
- package/lib/motion/shotcraft/upstream/demos/data/scroll-brake-moves/ChangelogScrollBrake.tsx +232 -0
- package/lib/motion/shotcraft/upstream/demos/data/timeline-travel/TimelineTravel.tsx +290 -0
- package/lib/motion/shotcraft/upstream/demos/effects/assemble-then-type-flyin/AssembleThenTypeFlyin.tsx +273 -0
- package/lib/motion/shotcraft/upstream/demos/effects/aurora-bloom-bg-flip/AuroraBloomBgFlip.tsx +167 -0
- package/lib/motion/shotcraft/upstream/demos/effects/brand-frame-snap/BrandFrameSnap.tsx +536 -0
- package/lib/motion/shotcraft/upstream/demos/effects/fui-hud-moves/ReticleLockOn.tsx +164 -0
- package/lib/motion/shotcraft/upstream/demos/effects/glow-flyline-moves/FlylineArc.tsx +175 -0
- package/lib/motion/shotcraft/upstream/demos/effects/glow-flyline-moves/GlowOrbAmbient.tsx +197 -0
- package/lib/motion/shotcraft/upstream/demos/effects/glow-flyline-moves/OrbFlylineRelay.tsx +241 -0
- package/lib/motion/shotcraft/upstream/demos/effects/icon-performance-moves/AttentionBounce.tsx +279 -0
- package/lib/motion/shotcraft/upstream/demos/effects/impact-feedback/AnimeImpact.tsx +230 -0
- package/lib/motion/shotcraft/upstream/demos/effects/impact-feedback/HitCounter.tsx +345 -0
- package/lib/motion/shotcraft/upstream/demos/effects/light-play-moves/SheenSweepRetry.tsx +275 -0
- package/lib/motion/shotcraft/upstream/demos/effects/light-play-moves/SpotlightSweepReveal.tsx +229 -0
- package/lib/motion/shotcraft/upstream/demos/effects/radial-ripple-phone-chips/RadialRipplePhoneChips.tsx +312 -0
- package/lib/motion/shotcraft/upstream/demos/effects/riso-print-hits/RisoMisregistrationHit.tsx +222 -0
- package/lib/motion/shotcraft/upstream/demos/effects/scan-bracket-sweep/ScanBracketSweep.tsx +295 -0
- package/lib/motion/shotcraft/upstream/demos/effects/scanline-annotate-focus/ScanlineAnnotateFocus.tsx +329 -0
- package/lib/motion/shotcraft/upstream/demos/effects/scanline-assemble-flyin/ScanlineAssembleFlyin.tsx +315 -0
- package/lib/motion/shotcraft/upstream/demos/effects/slam-entrance-moves/ImpactBurstKit.tsx +264 -0
- package/lib/motion/shotcraft/upstream/demos/effects/slam-entrance-moves/KanadaPerspectiveSnap.tsx +260 -0
- package/lib/motion/shotcraft/upstream/demos/effects/slam-entrance-moves/ScoreSlam.tsx +263 -0
- package/lib/motion/shotcraft/upstream/demos/effects/spotlight-sweep-moves/CornerSpotlightReveal.tsx +123 -0
- package/lib/motion/shotcraft/upstream/demos/effects/spotlight-sweep-moves/GlowWakeSleepPanel.tsx +187 -0
- package/lib/motion/shotcraft/upstream/demos/effects/spotlight-sweep-moves/SlideSpotlightPan.tsx +175 -0
- package/lib/motion/shotcraft/upstream/demos/interaction/autolayout-gap-dial/AutolayoutGapDial.tsx +305 -0
- package/lib/motion/shotcraft/upstream/demos/interaction/canvas-materialize-moves/DiagramCascadeBuild.tsx +350 -0
- package/lib/motion/shotcraft/upstream/demos/interaction/canvas-materialize-moves/PanelToCanvasMaterialize.tsx +352 -0
- package/lib/motion/shotcraft/upstream/demos/interaction/chip-grid-single-select-blackout/ChipGridSingleSelectBlackout.tsx +218 -0
- package/lib/motion/shotcraft/upstream/demos/interaction/collab-cursor-moves/CursorCastEnsemble.tsx +297 -0
- package/lib/motion/shotcraft/upstream/demos/interaction/glass-pill-dictation-typing/GlassPillDictationTyping.tsx +157 -0
- package/lib/motion/shotcraft/upstream/demos/interaction/hashtag-to-pill-materialize/HashtagToPillMaterialize.tsx +218 -0
- package/lib/motion/shotcraft/upstream/demos/interaction/picker-carousel-feature-cycle/PickerCarouselFeatureCycle.tsx +202 -0
- package/lib/motion/shotcraft/upstream/demos/interaction/segmented-thumb-hero/SegmentedThumbHero.tsx +265 -0
- package/lib/motion/shotcraft/upstream/demos/interaction/theme-switch-moves/PaletteThemeRipple.tsx +457 -0
- package/lib/motion/shotcraft/upstream/demos/interaction/theme-switch-moves/ThemeSweepToggle.tsx +446 -0
- package/lib/motion/shotcraft/upstream/demos/interaction/type-and-filter/TypeAndFilter.tsx +249 -0
- package/lib/motion/shotcraft/upstream/demos/interaction/voice-waveform-live/VoiceWaveformLive.tsx +278 -0
- package/lib/motion/shotcraft/upstream/demos/opening/crane-rise-reveal/CraneRiseReveal.tsx +332 -0
- package/lib/motion/shotcraft/upstream/demos/opening/dataviz-landscape-open/DatavizLandscapeOpen.tsx +358 -0
- package/lib/motion/shotcraft/upstream/demos/opening/fracture/Fracture.tsx +201 -0
- package/lib/motion/shotcraft/upstream/demos/opening/icon-field-colorize/IconFieldColorize.tsx +200 -0
- package/lib/motion/shotcraft/upstream/demos/opening/letterspace-materialize/LetterspaceMaterialize.tsx +208 -0
- package/lib/motion/shotcraft/upstream/demos/opening/magician-card-flourish/MagicianCardFlourish.tsx +341 -0
- package/lib/motion/shotcraft/upstream/demos/opening/orbit-ring-title-open/OrbitRingTitleOpen.tsx +389 -0
- package/lib/motion/shotcraft/upstream/demos/opening/spotlight-hero-card/SpotlightHeroCard.tsx +293 -0
- package/lib/motion/shotcraft/upstream/demos/opening/stroke-segment-build/StrokeSegmentBuild.tsx +183 -0
- package/lib/motion/shotcraft/upstream/demos/opening/text-as-mask/TextAsMask.tsx +245 -0
- package/lib/motion/shotcraft/upstream/demos/outro/grain-dissolve/GrainDissolve.tsx +222 -0
- package/lib/motion/shotcraft/upstream/demos/outro/logo-shrink-wordmark-lockup/LogoShrinkWordmarkLockup.tsx +223 -0
- package/lib/motion/shotcraft/upstream/demos/outro/neon-triple-marquee/NeonTripleMarquee.tsx +217 -0
- package/lib/motion/shotcraft/upstream/demos/outro/outro-group-photo-launch/OutroGroupPhotoLaunch.tsx +343 -0
- package/lib/motion/shotcraft/upstream/demos/outro/ui-strip-away-outro/UiStripAwayOutro.tsx +357 -0
- package/lib/motion/shotcraft/upstream/demos/outro/ui-to-brand-morph/IconFlipBloomLogo.tsx +187 -0
- package/lib/motion/shotcraft/upstream/demos/outro/ui-to-brand-morph/InputMorphsIntoLogo.tsx +333 -0
- package/lib/motion/shotcraft/upstream/demos/rhythm/beat-cut-moves/PaparazziFlash.tsx +274 -0
- package/lib/motion/shotcraft/upstream/demos/rhythm/beat-step-list-theme-cycle/BeatStepListThemeCycle.tsx +270 -0
- package/lib/motion/shotcraft/upstream/demos/rhythm/panel-grid-moves/ComicPanelSplit.tsx +430 -0
- package/lib/motion/shotcraft/upstream/demos/rhythm/quad-split-parallel-scenes/QuadSplitParallelScenes.tsx +252 -0
- package/lib/motion/shotcraft/upstream/demos/rhythm/rhythm-interrupt-moves/JumpCutPunchIn.tsx +106 -0
- package/lib/motion/shotcraft/upstream/demos/rhythm/sakuga-timing-shift/SakugaTimingShift.tsx +288 -0
- package/lib/motion/shotcraft/upstream/demos/rhythm/speed-ramp-freeze/FreezeAnnotateReal.tsx +362 -0
- package/lib/motion/shotcraft/upstream/demos/rhythm/trailer-grammar-moves/TrailerBumper.tsx +168 -0
- package/lib/motion/shotcraft/upstream/demos/transition/bottom-push-stack-wipe/BottomPushStackWipe.tsx +310 -0
- package/lib/motion/shotcraft/upstream/demos/transition/card-flip-reveal/CardFlipReveal.tsx +261 -0
- package/lib/motion/shotcraft/upstream/demos/transition/card-flock-tumble/CardFlockTumble.tsx +459 -0
- package/lib/motion/shotcraft/upstream/demos/transition/circle-match-iris/CircleMatchIris.tsx +294 -0
- package/lib/motion/shotcraft/upstream/demos/transition/gradient-transition/GradientTransition.tsx +161 -0
- package/lib/motion/shotcraft/upstream/demos/transition/line-carry-transition/LineCarryTransition.tsx +248 -0
- package/lib/motion/shotcraft/upstream/demos/transition/mosaic-reframe/MosaicReframe.tsx +359 -0
- package/lib/motion/shotcraft/upstream/demos/transition/page-turn-transitions/BarnDoorSplit.tsx +227 -0
- package/lib/motion/shotcraft/upstream/demos/transition/print-texture-transitions/InkBleedReveal.tsx +162 -0
- package/lib/motion/shotcraft/upstream/demos/transition/shot-transitions/PortalWipeV2.tsx +248 -0
- package/lib/motion/shotcraft/upstream/demos/transition/shot-transitions/WhipBrakeReal.tsx +186 -0
- package/lib/motion/shotcraft/upstream/demos/transition/tear-streak-transitions/GlitchDisplace.tsx +355 -0
- package/lib/motion/shotcraft/upstream/demos/transition/transition-hidden-cut/InvisibleCut.tsx +272 -0
- package/lib/motion/shotcraft/upstream/demos/transition/transition-hidden-cut/LightLeakBurn.tsx +262 -0
- package/lib/motion/shotcraft/upstream/demos/transition/transition-hidden-cut/VersusSlam.tsx +217 -0
- package/lib/motion/shotcraft/upstream/demos/transition/transition-travel/LetterformZoom.tsx +285 -0
- package/lib/motion/shotcraft/upstream/demos/transition/white-flash-logo-simplify-cut/WhiteFlashLogoSimplifyCut.tsx +205 -0
- package/lib/motion/shotcraft/upstream/demos/transition/wipe-transitions/BlindsSlice.tsx +178 -0
- package/lib/motion/shotcraft/upstream/demos/typography/blur-slide/BlurSlide.tsx +147 -0
- package/lib/motion/shotcraft/upstream/demos/typography/brace-expand/BraceExpand.tsx +143 -0
- package/lib/motion/shotcraft/upstream/demos/typography/brand-ink-open/BrandInkOpen.tsx +134 -0
- package/lib/motion/shotcraft/upstream/demos/typography/countdown-arc-scatter/CountdownArcScatter.tsx +217 -0
- package/lib/motion/shotcraft/upstream/demos/typography/flying-words/FlyingWords.tsx +198 -0
- package/lib/motion/shotcraft/upstream/demos/typography/glitch-cycle/GlitchCycle.tsx +221 -0
- package/lib/motion/shotcraft/upstream/demos/typography/gradient-word-sweep/GradientWordSweep.tsx +312 -0
- package/lib/motion/shotcraft/upstream/demos/typography/lead-word-zoom-assemble/LeadWordZoomAssemble.tsx +261 -0
- package/lib/motion/shotcraft/upstream/demos/typography/marker-underline-title/MarkerUnderlineTitle.tsx +121 -0
- package/lib/motion/shotcraft/upstream/demos/typography/outline-word-fill/OutlineWordFill.tsx +153 -0
- package/lib/motion/shotcraft/upstream/demos/typography/paper-title-card/PaperTitleCard.tsx +179 -0
- package/lib/motion/shotcraft/upstream/demos/typography/pill-chip-slot-cycle-handled/PillChipSlotCycleHandled.tsx +140 -0
- package/lib/motion/shotcraft/upstream/demos/typography/pill-slot-cycle/PillSlotCycle.tsx +309 -0
- package/lib/motion/shotcraft/upstream/demos/typography/text-column-converge/TextColumnConverge.tsx +191 -0
- package/lib/motion/shotcraft/upstream/demos/typography/title-demote-to-label/TitleDemoteToLabel.tsx +292 -0
- package/lib/motion/shotcraft/upstream/demos/typography/type-assembly-moves/LetterformDriftAssembly.tsx +135 -0
- package/lib/motion/shotcraft/upstream/demos/typography/type-assembly-moves/SplitTextStagger.tsx +124 -0
- package/lib/motion/shotcraft/upstream/demos/typography/type-assembly-moves/TextOnPath.tsx +255 -0
- package/lib/motion/shotcraft/upstream/demos/typography/type-entrance-moves/LetterDropPhysics.tsx +173 -0
- package/lib/motion/shotcraft/upstream/demos/typography/type-rhythm-sync/FontWeightPump.tsx +225 -0
- package/lib/motion/shotcraft/upstream/demos/typography/type-rhythm-sync/KaraokeFillSync.tsx +141 -0
- package/lib/motion/shotcraft/upstream/demos/typography/typewriter-moves/TypewriterErrorRetype.tsx +137 -0
- package/lib/motion/shotcraft/upstream/demos/typography/vertical-word-roll-blur-cycle/VerticalWordRollBlurCycle.tsx +147 -0
- package/lib/motion/shotcraft/upstream/demos/typography/word-relay-filmstrip/WordRelayFilmstrip.tsx +409 -0
- package/lib/motion/shotcraft/upstream/demos/typography/word-relay-geometry/WordRelayGeometry.tsx +280 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/avatar-bracket-carousel/AvatarBracketCarousel.tsx +271 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/bezier-source-converge-merge/BezierSourceConvergeMerge.tsx +385 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/card-stack/CardStack.tsx +312 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/carousel-3d/Carousel3D.tsx +303 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/clipcard-looping/ClipCardLooping.tsx +77 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/cloner-depth-echo/ClonerDepthEcho.tsx +311 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/deck-deal-flyin/DeckDealFlyin.tsx +307 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/doc-park-left-pill-deal/DocParkLeftPillDeal.tsx +349 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/document-typewriter-reveal/DocumentTypewriterReveal.tsx +255 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/draw-svg-trace/DrawSvgTrace.tsx +244 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/element-body-moves/ContactShadowLift.tsx +217 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/integration-hub-map/IntegrationHubMap.tsx +652 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/list-reveal/ListReveal.tsx +153 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/list-stack-press/ListStackPress.tsx +238 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/neon-frame-forerun/NeonFrameForerun.tsx +324 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/neon-frame-orbit-drop/NeonFrameForerunOrbit.tsx +354 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/page-waterfall-wall/PageWaterfallWall.tsx +101 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/page-waterfall-wall/VerticalTicker.tsx +129 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/product-card-progressive-assemble/ProductCardProgressiveAssemble.tsx +297 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/radial-wave/RadialWave.tsx +57 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/research-card-stack-scroll/ResearchCardStackScroll.tsx +155 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/row-embed/RowEmbed.tsx +175 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/value-stagger-gradient/ValueStaggerGradient.tsx +153 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/wall-reveal-moves/BentoLightUp.tsx +146 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/wall-reveal-moves/WireframeDrawOn.tsx +226 -0
- package/lib/motion/shotcraft/upstream/gallery/api/library.json +1 -0
- package/lib/motion/shotcraft/upstream/manifest.json +2715 -0
- package/lib/motion/shotcraft/upstream/references/aesthetic-rules.md +193 -0
- package/lib/motion/shotcraft/upstream/references/final-review.md +121 -0
- package/lib/motion/shotcraft/upstream/references/guided-free-creation.md +199 -0
- package/lib/motion/shotcraft/upstream/references/jianying-export.md +183 -0
- package/lib/motion/shotcraft/upstream/references/music-beat-sync.md +257 -0
- package/lib/motion/shotcraft/upstream/references/pipeline.md +382 -0
- package/lib/motion/shotcraft/upstream/references/publish-upload-post.md +111 -0
- package/lib/motion/shotcraft/upstream/references/sequences/promo-energy-arc.md +50 -0
- package/lib/motion/shotcraft/upstream/references/sfx-sourcing.md +95 -0
- package/lib/motion/shotcraft/upstream/references/shots/camera/basic-3d-scene.md +41 -0
- package/lib/motion/shotcraft/upstream/references/shots/camera/crash-zoom-punch.md +52 -0
- package/lib/motion/shotcraft/upstream/references/shots/camera/cursor-flyover.md +39 -0
- package/lib/motion/shotcraft/upstream/references/shots/camera/depth-layer-moves.md +39 -0
- package/lib/motion/shotcraft/upstream/references/shots/camera/graze-face-tour.md +57 -0
- package/lib/motion/shotcraft/upstream/references/shots/camera/overhead-camera-moves.md +51 -0
- package/lib/motion/shotcraft/upstream/references/shots/camera/space-camera-moves.md +46 -0
- package/lib/motion/shotcraft/upstream/references/shots/camera/steep-tilt-glide.md +52 -0
- package/lib/motion/shotcraft/upstream/references/shots/camera/tension-camera-moves.md +43 -0
- package/lib/motion/shotcraft/upstream/references/shots/camera/terminal-3d.md +42 -0
- package/lib/motion/shotcraft/upstream/references/shots/data/before-after-slider-scrub.md +48 -0
- package/lib/motion/shotcraft/upstream/references/shots/data/chart-live-moves.md +52 -0
- package/lib/motion/shotcraft/upstream/references/shots/data/gauge-readout-moves.md +45 -0
- package/lib/motion/shotcraft/upstream/references/shots/data/scroll-brake-moves.md +46 -0
- package/lib/motion/shotcraft/upstream/references/shots/data/timeline-travel.md +44 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/assemble-then-type-flyin.md +63 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/aurora-bloom-bg-flip.md +54 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/brand-frame-snap.md +58 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/fui-hud-moves.md +35 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/glow-flyline-moves.md +53 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/icon-performance-moves.md +42 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/impact-feedback.md +50 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/light-play-moves.md +46 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/radial-ripple-phone-chips.md +56 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/riso-print-hits.md +49 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/scan-bracket-sweep.md +50 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/scanline-annotate-focus.md +53 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/scanline-assemble-flyin.md +53 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/slam-entrance-moves.md +55 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/spotlight-sweep-moves.md +52 -0
- package/lib/motion/shotcraft/upstream/references/shots/interaction/autolayout-gap-dial.md +60 -0
- package/lib/motion/shotcraft/upstream/references/shots/interaction/canvas-materialize-moves.md +57 -0
- package/lib/motion/shotcraft/upstream/references/shots/interaction/chip-grid-single-select-blackout.md +51 -0
- package/lib/motion/shotcraft/upstream/references/shots/interaction/collab-cursor-moves.md +41 -0
- package/lib/motion/shotcraft/upstream/references/shots/interaction/glass-pill-dictation-typing.md +53 -0
- package/lib/motion/shotcraft/upstream/references/shots/interaction/hashtag-to-pill-materialize.md +60 -0
- package/lib/motion/shotcraft/upstream/references/shots/interaction/picker-carousel-feature-cycle.md +55 -0
- package/lib/motion/shotcraft/upstream/references/shots/interaction/segmented-thumb-hero.md +57 -0
- package/lib/motion/shotcraft/upstream/references/shots/interaction/theme-switch-moves.md +47 -0
- package/lib/motion/shotcraft/upstream/references/shots/interaction/type-and-filter.md +37 -0
- package/lib/motion/shotcraft/upstream/references/shots/interaction/voice-waveform-live.md +54 -0
- package/lib/motion/shotcraft/upstream/references/shots/opening/brand-ink-open.md +36 -0
- package/lib/motion/shotcraft/upstream/references/shots/opening/crane-rise-reveal.md +56 -0
- package/lib/motion/shotcraft/upstream/references/shots/opening/dataviz-landscape-open.md +56 -0
- package/lib/motion/shotcraft/upstream/references/shots/opening/fracture.md +40 -0
- package/lib/motion/shotcraft/upstream/references/shots/opening/icon-field-colorize.md +60 -0
- package/lib/motion/shotcraft/upstream/references/shots/opening/letterspace-materialize.md +57 -0
- package/lib/motion/shotcraft/upstream/references/shots/opening/magician-card-flourish.md +73 -0
- package/lib/motion/shotcraft/upstream/references/shots/opening/orbit-ring-title-open.md +87 -0
- package/lib/motion/shotcraft/upstream/references/shots/opening/spotlight-hero-card.md +55 -0
- package/lib/motion/shotcraft/upstream/references/shots/opening/stroke-segment-build.md +50 -0
- package/lib/motion/shotcraft/upstream/references/shots/opening/text-as-mask.md +59 -0
- package/lib/motion/shotcraft/upstream/references/shots/outro/grain-dissolve.md +38 -0
- package/lib/motion/shotcraft/upstream/references/shots/outro/logo-shrink-wordmark-lockup.md +38 -0
- package/lib/motion/shotcraft/upstream/references/shots/outro/neon-triple-marquee.md +59 -0
- package/lib/motion/shotcraft/upstream/references/shots/outro/outro-group-photo-launch.md +39 -0
- package/lib/motion/shotcraft/upstream/references/shots/outro/ui-strip-away-outro.md +61 -0
- package/lib/motion/shotcraft/upstream/references/shots/outro/ui-to-brand-morph.md +52 -0
- package/lib/motion/shotcraft/upstream/references/shots/rhythm/beat-cut-moves.md +50 -0
- package/lib/motion/shotcraft/upstream/references/shots/rhythm/beat-step-list-theme-cycle.md +66 -0
- package/lib/motion/shotcraft/upstream/references/shots/rhythm/panel-grid-moves.md +43 -0
- package/lib/motion/shotcraft/upstream/references/shots/rhythm/quad-split-parallel-scenes.md +38 -0
- package/lib/motion/shotcraft/upstream/references/shots/rhythm/rhythm-interrupt-moves.md +38 -0
- package/lib/motion/shotcraft/upstream/references/shots/rhythm/sakuga-timing-shift.md +56 -0
- package/lib/motion/shotcraft/upstream/references/shots/rhythm/speed-ramp-freeze.md +44 -0
- package/lib/motion/shotcraft/upstream/references/shots/rhythm/trailer-grammar-moves.md +38 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/bottom-push-stack-wipe.md +63 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/card-flip-reveal.md +57 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/card-flock-tumble.md +63 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/circle-match-iris.md +58 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/gradient-transition.md +45 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/line-carry-transition.md +55 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/mosaic-reframe.md +49 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/page-turn-transitions.md +42 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/print-texture-transitions.md +42 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/shot-transitions.md +45 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/tear-streak-transitions.md +48 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/transition-hidden-cut.md +55 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/transition-travel.md +43 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/white-flash-logo-simplify-cut.md +41 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/wipe-transitions.md +42 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/blur-slide.md +59 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/brace-expand.md +55 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/countdown-arc-scatter.md +65 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/document-typewriter-reveal.md +42 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/flying-words.md +64 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/glitch-cycle.md +64 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/gradient-word-sweep.md +54 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/lead-word-zoom-assemble.md +91 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/marker-underline-title.md +51 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/outline-word-fill.md +66 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/paper-title-card.md +38 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/pill-chip-slot-cycle-handled.md +66 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/pill-slot-cycle.md +58 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/text-column-converge.md +61 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/title-demote-to-label.md +64 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/type-assembly-moves.md +45 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/type-entrance-moves.md +41 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/type-rhythm-sync.md +51 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/typewriter-moves.md +42 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/vertical-word-roll-blur-cycle.md +63 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/word-relay-filmstrip.md +57 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/word-relay-geometry.md +75 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/avatar-bracket-carousel.md +59 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/bezier-source-converge-merge.md +67 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/card-stack.md +60 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/carousel-3d.md +66 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/cloner-depth-echo.md +40 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/deck-deal-flyin.md +45 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/doc-park-left-pill-deal.md +62 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/draw-svg-trace.md +55 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/element-body-moves.md +37 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/integration-hub-map.md +55 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/list-reveal.md +50 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/list-stack-press.md +43 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/neon-frame-forerun.md +55 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/neon-frame-orbit-drop.md +51 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/page-waterfall-wall.md +51 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/product-card-progressive-assemble.md +56 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/radial-wave.md +49 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/research-card-stack-scroll.md +57 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/row-embed.md +36 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/value-stagger-gradient.md +64 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/wall-reveal-moves.md +47 -0
- package/lib/motion/shotcraft/upstream/references/sound-design.md +170 -0
- package/lib/motion/shotcraft/upstream/references/workbench.md +157 -0
- package/lib/motion/shotcraft/upstream/template/TEMPLATE.md +103 -0
- package/lib/motion/shotcraft/upstream/template/THEMES.md +44 -0
- package/lib/motion/shotcraft/upstream/template/package.json +20 -0
- package/lib/motion/shotcraft/upstream/template/remotion.config.ts +6 -0
- package/lib/motion/shotcraft/upstream/template/src/Root.tsx +17 -0
- package/lib/motion/shotcraft/upstream/template/src/aifl/Caption.tsx +65 -0
- package/lib/motion/shotcraft/upstream/template/src/aifl/DigitRoll.tsx +48 -0
- package/lib/motion/shotcraft/upstream/template/src/aifl/FlashCut.tsx +24 -0
- package/lib/motion/shotcraft/upstream/template/src/aifl/Main.tsx +192 -0
- package/lib/motion/shotcraft/upstream/template/src/aifl/PaperTitleCard.tsx +111 -0
- package/lib/motion/shotcraft/upstream/template/src/aifl/live/PageCam.tsx +150 -0
- package/lib/motion/shotcraft/upstream/template/src/aifl/live/SceneDetail.tsx +158 -0
- package/lib/motion/shotcraft/upstream/template/src/aifl/live/SceneFlyIn.tsx +468 -0
- package/lib/motion/shotcraft/upstream/template/src/aifl/live/SceneOpen.tsx +552 -0
- package/lib/motion/shotcraft/upstream/template/src/aifl/live/SceneOutroLive.tsx +411 -0
- package/lib/motion/shotcraft/upstream/template/src/aifl/live/ScenePapers.tsx +200 -0
- package/lib/motion/shotcraft/upstream/template/src/aifl/live/SceneWbr.tsx +324 -0
- package/lib/motion/shotcraft/upstream/template/src/aifl/live-layout.json +389 -0
- package/lib/motion/shotcraft/upstream/template/src/index.ts +4 -0
- package/lib/motion/shotcraft/upstream/template/src/themes/ThemedFilm.tsx +7 -0
- package/lib/motion/shotcraft/upstream/template/src/themes/manifest.tsx +68 -0
- package/lib/motion/shotcraft/upstream/template/src/themes/palette-assets.json +1 -0
- package/lib/motion/shotcraft/upstream/template/src/themes/palette-assets.ts +24 -0
- package/lib/motion/shotcraft/upstream/template/src/themes/palettes.json +74 -0
- package/lib/motion/shotcraft/upstream/template/src/themes/visual-theme.tsx +91 -0
- package/lib/motion/shotcraft/upstream/template/src/workbench.ts +213 -0
- package/lib/motion/shotcraft/upstream/template/tsconfig.json +15 -0
- package/lib/motion/spec.js +113 -0
- package/lib/motion/style-engine.js +153 -0
- package/lib/motion/style-frames.js +268 -0
- package/lib/motion/sync.js +214 -0
- package/lib/motion/theme.js +121 -0
- package/lib/motion/voice.js +417 -0
- package/lib/motion-agent-files.js +82 -0
- package/lib/motion-agent-protocol.js +66 -0
- package/lib/motion-agent-tools.js +196 -0
- package/lib/motion-agent.js +171 -0
- package/lib/motion-capture.js +92 -0
- package/lib/motion-core.js +238 -0
- package/lib/motion-film-review.js +71 -0
- package/lib/motion-library.js +210 -0
- package/lib/motion-planner.js +254 -0
- package/lib/motion-project.js +80 -0
- package/lib/motion-render-worker.js +145 -0
- package/lib/motion-session.js +32 -0
- package/lib/motion-source.js +49 -0
- package/lib/motion-tasks.js +452 -0
- package/lib/motion-vision.js +43 -0
- package/lib/mxfile.js +27 -7
- package/lib/routing/node-runtime.js +14 -0
- package/lib/routing/router.js +211 -0
- package/lib/routing/vendor/README.md +96 -0
- package/lib/routing/vendor/libavoid-routing.js +753 -0
- package/lib/routing/vendor/libavoid.min.js +59 -0
- package/lib/shotcard-core.js +39 -0
- package/lib/shotcard-reference.js +56 -0
- package/lib/style-kernel.js +37 -3
- package/lib/task-patches.js +26 -2
- package/lib/video-export.js +17 -2
- package/package.json +29 -4
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# edge-tts 说话(一次一句):拿音频 + 词级时间戳。
|
|
3
|
+
#
|
|
4
|
+
# 为什么要这个脚本,而不是直接调 `py -m edge_tts`:
|
|
5
|
+
# 1) CLI 没有 --words-in-cue(7.3.1 只有 text/voice/rate/volume/pitch/write-media/write-subtitles),
|
|
6
|
+
# 词级边界只能从 Communicate.stream() 的 WordBoundary 事件拿;
|
|
7
|
+
# 2) 走文件传参,不开管道 —— 受限环境里 spawn + pipe 会直接 EPERM。
|
|
8
|
+
#
|
|
9
|
+
# 用法:python edge-speech.py <job.json>
|
|
10
|
+
# job.json { "text", "voice", "rate", "pitch", "out": "<mp3 绝对路径>" }
|
|
11
|
+
# 产物:<mp3> 与 <job.json 去掉 .json>+".result.json"
|
|
12
|
+
# 结果 JSON { ok, file, seconds, words:[{text, offsetMs, durMs}], voice }
|
|
13
|
+
#
|
|
14
|
+
# 时长按 CBR 算:edge 输出固定 48kbps 单声道,字节数 / 6000 = 秒,比再起一个 ffmpeg 便宜。
|
|
15
|
+
|
|
16
|
+
import asyncio
|
|
17
|
+
import json
|
|
18
|
+
import os
|
|
19
|
+
import sys
|
|
20
|
+
|
|
21
|
+
TICKS_PER_MS = 10000
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
async def run(job):
|
|
25
|
+
import edge_tts
|
|
26
|
+
|
|
27
|
+
out = job["out"]
|
|
28
|
+
os.makedirs(os.path.dirname(out), exist_ok=True)
|
|
29
|
+
# boundary 默认是 SentenceBoundary —— 想要词级就必须显式要 WordBoundary,
|
|
30
|
+
# 否则 stream() 里永远不会出现词边界(中文也一样,是引擎侧的切分)。
|
|
31
|
+
communicate = edge_tts.Communicate(
|
|
32
|
+
job["text"],
|
|
33
|
+
job.get("voice") or "zh-CN-XiaoxiaoNeural",
|
|
34
|
+
rate=job.get("rate") or "+0%",
|
|
35
|
+
pitch=job.get("pitch") or "+0Hz",
|
|
36
|
+
boundary=job.get("boundary") or "WordBoundary",
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
audio = bytearray()
|
|
40
|
+
words = []
|
|
41
|
+
sentences = []
|
|
42
|
+
async for chunk in communicate.stream():
|
|
43
|
+
kind = chunk.get("type")
|
|
44
|
+
if kind == "audio":
|
|
45
|
+
audio.extend(chunk["data"])
|
|
46
|
+
elif kind in ("WordBoundary", "SentenceBoundary"):
|
|
47
|
+
entry = {
|
|
48
|
+
"text": chunk["text"],
|
|
49
|
+
"offsetMs": round(chunk["offset"] / TICKS_PER_MS),
|
|
50
|
+
"durMs": round(chunk["duration"] / TICKS_PER_MS),
|
|
51
|
+
"kind": "word" if kind == "WordBoundary" else "sentence",
|
|
52
|
+
}
|
|
53
|
+
(words if kind == "WordBoundary" else sentences).append(entry)
|
|
54
|
+
|
|
55
|
+
if not audio:
|
|
56
|
+
raise RuntimeError("edge-tts 没有返回音频(凭据被拒或文本为空)")
|
|
57
|
+
|
|
58
|
+
with open(out, "wb") as handle:
|
|
59
|
+
handle.write(audio)
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
"ok": True,
|
|
63
|
+
"file": out,
|
|
64
|
+
"seconds": round(len(audio) * 8 / 48000, 3),
|
|
65
|
+
# 词边界拿不到就退回句边界:至少字幕还能按句落点,不是全空。
|
|
66
|
+
"words": words or sentences,
|
|
67
|
+
"sentences": sentences,
|
|
68
|
+
"voice": job.get("voice") or "zh-CN-XiaoxiaoNeural",
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def main():
|
|
73
|
+
if len(sys.argv) < 2:
|
|
74
|
+
print("需要 job.json 路径", file=sys.stderr)
|
|
75
|
+
return 2
|
|
76
|
+
job_path = sys.argv[1]
|
|
77
|
+
with open(job_path, "r", encoding="utf-8") as handle:
|
|
78
|
+
job = json.load(handle)
|
|
79
|
+
result_path = os.path.splitext(job_path)[0] + ".result.json"
|
|
80
|
+
try:
|
|
81
|
+
result = asyncio.run(run(job))
|
|
82
|
+
except Exception as error: # 交给调用方决定换 provider,不在这里退出码定生死
|
|
83
|
+
result = {"ok": False, "error": "%s: %s" % (type(error).__name__, error)}
|
|
84
|
+
with open(result_path, "w", encoding="utf-8") as handle:
|
|
85
|
+
json.dump(result, handle, ensure_ascii=False)
|
|
86
|
+
return 0 if result.get("ok") else 1
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
if __name__ == "__main__":
|
|
90
|
+
sys.exit(main())
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { registerRoot, Composition, AbsoluteFill, Sequence, Audio, staticFile, delayRender, continueRender, cancelRender } from 'remotion'
|
|
3
|
+
const defaults = { plan: { width: 1280, height: 720, fps: 30, durationFrames: 90, shots: [], audio: [] }, assets: {} }
|
|
4
|
+
|
|
5
|
+
// 音频条目的增益曲线:dB → 线性,再叠淡入淡出。
|
|
6
|
+
// volume 回调收到的是"本条 Audio 自己的局部帧"(从 0 开始)。
|
|
7
|
+
function gainOf(cue, local) {
|
|
8
|
+
let gain = Math.pow(10, (Number(cue.gainDb) || 0) / 20)
|
|
9
|
+
if (cue.fadeIn > 0) gain *= Math.min(1, local / cue.fadeIn)
|
|
10
|
+
if (cue.fadeOut > 0) gain *= Math.min(1, (cue.durationInFrames - local) / cue.fadeOut)
|
|
11
|
+
return Math.max(0, Math.min(4, gain))
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// 旁白避让:进入旁白区间压到 -12dB,两端各留 6 帧斜坡。
|
|
15
|
+
function duckFactor(local, windows, depthDb, ramp) {
|
|
16
|
+
const depth = Math.pow(10, depthDb / 20)
|
|
17
|
+
let factor = 1
|
|
18
|
+
for (const window of windows) {
|
|
19
|
+
if (local >= window.from && local <= window.to) factor = Math.min(factor, depth)
|
|
20
|
+
else if (local >= window.from - ramp && local < window.from) {
|
|
21
|
+
factor = Math.min(factor, 1 - (1 - depth) * ((local - (window.from - ramp)) / ramp))
|
|
22
|
+
} else if (local > window.to && local <= window.to + ramp) {
|
|
23
|
+
factor = Math.min(factor, depth + (1 - depth) * ((local - window.to) / ramp))
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return factor
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function registerMotionRoot(scenes) {
|
|
30
|
+
function Movie({ plan, assets }) {
|
|
31
|
+
const [fontWait] = React.useState(() => plan.bundledFonts ? delayRender('加载内置中文字体') : null)
|
|
32
|
+
React.useEffect(() => {
|
|
33
|
+
if (fontWait === null) return
|
|
34
|
+
Promise.all([document.fonts.load('400 16px "Noto Sans SC"'), document.fonts.load('400 16px "Noto Serif SC"')])
|
|
35
|
+
.then(() => document.fonts.ready).then(() => continueRender(fontWait)).catch(error => cancelRender(error))
|
|
36
|
+
}, [fontWait])
|
|
37
|
+
const fps = plan.fps || 30
|
|
38
|
+
const audio = Array.isArray(plan.audio) ? plan.audio : []
|
|
39
|
+
const voices = audio.filter((cue) => cue.role === 'voice')
|
|
40
|
+
.map((cue) => ({ from: Math.max(0, cue.from - 4), to: cue.from + cue.durationInFrames + 8 }))
|
|
41
|
+
return (
|
|
42
|
+
<AbsoluteFill>
|
|
43
|
+
{plan.bundledFonts && <style>{(plan.fontFaces || []).map(face => `@font-face{font-family:${JSON.stringify(face.family)};src:url(${JSON.stringify(staticFile('fonts/' + face.file))}) format("truetype");font-weight:${face.weight};font-style:${face.style};font-display:block}`).join('\n')}</style>}
|
|
44
|
+
{plan.shots.map((shot) => {
|
|
45
|
+
const Component = scenes[shot.id]
|
|
46
|
+
if (shot.recipeId !== 'scene' || !Component) throw new Error('场景组件缺失:' + shot.id)
|
|
47
|
+
const allowed = Object.fromEntries(shot.referenceIds.map((id) => [id, assets[id] || []]))
|
|
48
|
+
// render 是这条片子的渲染规格(samples / shutter / scale):场景按它决定
|
|
49
|
+
// 累积几个子帧、开多久快门,不要自己写死数字——写死了改规格就没人跟着改。
|
|
50
|
+
return <Sequence key={shot.id} from={shot.startFrame} durationInFrames={shot.durationInFrames ?? shot.durationFrames}><Component shot={shot} anchors={shot.anchors || {}} assets={allowed} render={plan.render || {}} /></Sequence>
|
|
51
|
+
})}
|
|
52
|
+
{audio.map((cue) => {
|
|
53
|
+
const local = cue.duck ? voices.map((window) => ({ from: window.from - cue.from, to: window.to - cue.from })) : []
|
|
54
|
+
return (
|
|
55
|
+
<Sequence key={cue.id} from={cue.from} durationInFrames={cue.durationInFrames}>
|
|
56
|
+
<Audio
|
|
57
|
+
src={staticFile(cue.file)}
|
|
58
|
+
startFrom={Math.max(0, Math.round((Number(cue.trimStart) || 0) * fps))}
|
|
59
|
+
loop={cue.loop === true}
|
|
60
|
+
volume={(frame) => gainOf(cue, frame) * (cue.duck ? duckFactor(frame, local, -12, 6) : 1)}
|
|
61
|
+
/>
|
|
62
|
+
</Sequence>
|
|
63
|
+
)
|
|
64
|
+
})}
|
|
65
|
+
</AbsoluteFill>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
function Root() {
|
|
69
|
+
return <Composition id="DrawAiMotion" component={Movie} width={1280} height={720} fps={30} durationInFrames={90} defaultProps={defaults}
|
|
70
|
+
calculateMetadata={({ props }) => ({ width: props.plan.width, height: props.plan.height, fps: props.plan.fps, durationInFrames: props.plan.durationFrames })} />
|
|
71
|
+
}
|
|
72
|
+
registerRoot(Root)
|
|
73
|
+
}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
// 导出:把一条成片拆成"能在剪映里继续剪"的素材包。
|
|
2
|
+
//
|
|
3
|
+
// 上游 references/jianying-export.md 讲的就是这件事(逐镜头 clip + 独立
|
|
4
|
+
// 字幕轨 + 独立的 SFX/BGM 轨),但仓库里没有实现。这里按文件落地的版本:
|
|
5
|
+
//
|
|
6
|
+
// clips/shot-N.mp4 逐镜头、无声、按时间轴精确切
|
|
7
|
+
// audio/bgm-1.mp3 原音轨原文件(带 cue 时间点与增益记录)
|
|
8
|
+
// subtitles.srt 有字幕数据时写出,剪映可直接导入
|
|
9
|
+
// shots.json 顺序、进出点、帧号 —— 重建时间轴靠它
|
|
10
|
+
// README.md 怎么在剪映里拼回去
|
|
11
|
+
// draft_content.json draft:true 时的剪映草稿(结构草案,未在剪映里验证)
|
|
12
|
+
//
|
|
13
|
+
// 切镜头用"输入侧 -ss + 重编码",不是 -c copy:copy 只能从关键帧切,
|
|
14
|
+
// 边界会偏 1–2 秒,而这里必须帧对帧。
|
|
15
|
+
|
|
16
|
+
import { copyFileSync, existsSync, mkdirSync, readdirSync, rmSync, statSync, writeFileSync } from 'node:fs'
|
|
17
|
+
import { basename, extname, join } from 'node:path'
|
|
18
|
+
import { randomUUID } from 'node:crypto'
|
|
19
|
+
import { runFfmpeg } from './ffmpeg.js'
|
|
20
|
+
|
|
21
|
+
export function exportRoot(dir) {
|
|
22
|
+
return join(dir, '.out', 'export')
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function exportFolder(dir, name = 'jianying') {
|
|
26
|
+
return join(exportRoot(dir), name)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const round = (value, digits = 3) => Math.round(value * 10 ** digits) / 10 ** digits
|
|
30
|
+
|
|
31
|
+
function srtTime(seconds) {
|
|
32
|
+
const total = Math.max(0, seconds)
|
|
33
|
+
const pad = (value, size = 2) => String(Math.floor(value)).padStart(size, '0')
|
|
34
|
+
const hours = Math.floor(total / 3600), minutes = Math.floor((total % 3600) / 60), secs = Math.floor(total % 60)
|
|
35
|
+
const ms = Math.round((total - Math.floor(total)) * 1000)
|
|
36
|
+
return pad(hours) + ':' + pad(minutes) + ':' + pad(secs) + ',' + pad(ms, 3)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function subtitleRows(timeline, extra) {
|
|
40
|
+
const list = Array.isArray(extra) ? extra : Array.isArray(timeline.subtitles) ? timeline.subtitles : []
|
|
41
|
+
const fps = Number(timeline.fps) || 30
|
|
42
|
+
return list.map((row, index) => {
|
|
43
|
+
const fromFrame = Number(row.startFrame ?? row.from ?? 0)
|
|
44
|
+
const toFrame = Number(row.endFrame ?? row.to ?? fromFrame + Math.round(fps * 2.5))
|
|
45
|
+
return { index: index + 1, from: fromFrame / fps, to: toFrame / fps, text: String(row.text ?? row.copy ?? '').trim() }
|
|
46
|
+
}).filter((row) => row.text && row.to > row.from)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function srtSource(rows) {
|
|
50
|
+
return rows.map((row) => row.index + '\n' + srtTime(row.from) + ' --> ' + srtTime(row.to) + '\n' + row.text + '\n').join('\n')
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// 剪映草稿:按 360000 这一版的结构摆出视频/音频/文本三条轨。
|
|
54
|
+
// 只保证结构自洽(材料 id 对得上、时长对得上),不保证剪映各版本都认。
|
|
55
|
+
function jianyingDraft({ timeline, shots, stems, subtitles, folder }) {
|
|
56
|
+
const fps = Number(timeline.fps) || 30
|
|
57
|
+
const us = (seconds) => Math.round(seconds * 1e6)
|
|
58
|
+
const videoMaterials = shots.map((shot) => ({
|
|
59
|
+
id: randomUUID().toUpperCase(), type: 'video', path: join(folder, 'clips', shot.id + '.mp4'),
|
|
60
|
+
width: timeline.width, height: timeline.height, duration: us(shot.seconds), has_audio: false, reverse: false,
|
|
61
|
+
}))
|
|
62
|
+
const audioMaterials = stems.map((stem) => ({
|
|
63
|
+
id: randomUUID().toUpperCase(), type: 'extract_music', path: join(folder, stem.source),
|
|
64
|
+
duration: us(stem.seconds), name: basename(stem.source),
|
|
65
|
+
}))
|
|
66
|
+
const textMaterials = subtitles.map((row) => ({
|
|
67
|
+
id: randomUUID().toUpperCase(), type: 'subtitle', content: row.text, alignment: 1,
|
|
68
|
+
font_size: 6, text_color: '#2A2724',
|
|
69
|
+
}))
|
|
70
|
+
const videoSegments = shots.map((shot, index) => ({
|
|
71
|
+
id: randomUUID().toUpperCase(), material_id: videoMaterials[index].id, volume: 1, speed: 1,
|
|
72
|
+
source_timerange: { start: 0, duration: us(shot.seconds) },
|
|
73
|
+
target_timerange: { start: us(shot.from), duration: us(shot.seconds) },
|
|
74
|
+
}))
|
|
75
|
+
const audioSegments = stems.map((stem, index) => ({
|
|
76
|
+
id: randomUUID().toUpperCase(), material_id: audioMaterials[index].id,
|
|
77
|
+
volume: round(10 ** (Number(stem.gainDb || 0) / 20), 3), speed: 1,
|
|
78
|
+
source_timerange: { start: 0, duration: us(stem.seconds) },
|
|
79
|
+
target_timerange: { start: us(stem.at), duration: us(stem.seconds) },
|
|
80
|
+
}))
|
|
81
|
+
const textSegments = subtitles.map((row, index) => ({
|
|
82
|
+
id: randomUUID().toUpperCase(), material_id: textMaterials[index].id,
|
|
83
|
+
target_timerange: { start: us(row.from), duration: us(row.to - row.from) },
|
|
84
|
+
}))
|
|
85
|
+
return {
|
|
86
|
+
id: randomUUID().toUpperCase(),
|
|
87
|
+
version: 360000,
|
|
88
|
+
fps,
|
|
89
|
+
duration: us(Number(timeline.durationInFrames) / fps),
|
|
90
|
+
canvas_config: { width: timeline.width, height: timeline.height, ratio: 'original' },
|
|
91
|
+
materials: { videos: videoMaterials, audios: audioMaterials, texts: textMaterials },
|
|
92
|
+
tracks: [
|
|
93
|
+
{ id: randomUUID().toUpperCase(), type: 'video', attribute: 0, segments: videoSegments },
|
|
94
|
+
{ id: randomUUID().toUpperCase(), type: 'audio', attribute: 0, segments: audioSegments },
|
|
95
|
+
{ id: randomUUID().toUpperCase(), type: 'text', attribute: 0, segments: textSegments },
|
|
96
|
+
],
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function readmeOf({ timeline, shots, stems, subtitles, missing }) {
|
|
101
|
+
const fps = Number(timeline.fps) || 30
|
|
102
|
+
const total = Number(timeline.durationInFrames) / fps
|
|
103
|
+
const lines = [
|
|
104
|
+
'# 剪映素材包',
|
|
105
|
+
'',
|
|
106
|
+
'这条片子是 ' + timeline.width + '×' + timeline.height + ' / ' + fps + 'fps / ' + total.toFixed(2) + ' 秒,拆成了 '
|
|
107
|
+
+ shots.length + ' 个镜头 + ' + stems.length + ' 条音轨。',
|
|
108
|
+
'',
|
|
109
|
+
'## 里面有什么',
|
|
110
|
+
'',
|
|
111
|
+
'- `clips/` 逐镜头画面,无声,按时间轴精确切(首尾帧与时间轴一致)。',
|
|
112
|
+
'- `audio/` 原音轨文件(BGM 与音效分开),时间点与增益见 `audio.json`。',
|
|
113
|
+
'- `shots.json` 镜头顺序、进出点、帧号。',
|
|
114
|
+
'- `film.mp4` 完整成片,用来对照。',
|
|
115
|
+
subtitles ? '- `subtitles.srt` 字幕,剪映里可直接导入为字幕轨。' : '- 没有字幕数据(时间轴里没有 subtitles)。',
|
|
116
|
+
'',
|
|
117
|
+
'## 在剪映里拼回去',
|
|
118
|
+
'',
|
|
119
|
+
'1. 新建项目,画布设为 ' + timeline.width + '×' + timeline.height + '、' + fps + 'fps。',
|
|
120
|
+
'2. 按 `shots.json` 的顺序把 `clips/` 拖上主轨,首尾相接——它们是按顺序切好的,中间不要留空。',
|
|
121
|
+
'3. 按 `audio.json` 的 `at` 秒把 `audio/` 里的文件放到对应位置;BGM 那条是整条铺满的,音效是点。',
|
|
122
|
+
subtitles
|
|
123
|
+
? '4. 字幕:拖入 `subtitles.srt`,剪映会按时间码落到字幕轨。'
|
|
124
|
+
: '4. 这条片子没有字幕数据;要字幕就回工程里补 subtitles 再导出一次。',
|
|
125
|
+
'5. 需要改节奏就拖 clip 边界;画面内容要改,回工程里改场景代码重新导出,不要在这边抠图。',
|
|
126
|
+
'',
|
|
127
|
+
'## 来源',
|
|
128
|
+
'',
|
|
129
|
+
'',
|
|
130
|
+
]
|
|
131
|
+
if (missing.length) lines.splice(lines.indexOf('## 来源'), 0, '## 缺失', '', '这些音轨文件在工程里找不到:' + missing.join('、'), '')
|
|
132
|
+
return lines.join('\n')
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export async function exportPackage({ dir, timeline, name, draft = false, subtitles, film, onProgress }) {
|
|
136
|
+
if (!timeline || !Array.isArray(timeline.shots) || !timeline.shots.length) throw new Error('时间轴里没有镜头')
|
|
137
|
+
const source = film || join(dir, '.out', 'film.mp4')
|
|
138
|
+
if (!existsSync(source)) throw new Error('没有成片可导出:先 motion_render start 出一版(' + source + ')')
|
|
139
|
+
const fps = Number(timeline.fps) || 30
|
|
140
|
+
const folder = exportFolder(dir, name)
|
|
141
|
+
rmSync(folder, { recursive: true, force: true })
|
|
142
|
+
mkdirSync(join(folder, 'clips'), { recursive: true })
|
|
143
|
+
mkdirSync(join(folder, 'audio'), { recursive: true })
|
|
144
|
+
|
|
145
|
+
const shots = []
|
|
146
|
+
for (const [index, shot] of timeline.shots.entries()) {
|
|
147
|
+
const from = shot.startFrame / fps, to = (shot.startFrame + shot.durationFrames) / fps
|
|
148
|
+
const clip = join(folder, 'clips', shot.id + '.mp4')
|
|
149
|
+
await runFfmpeg(['-ss', from.toFixed(3), '-to', to.toFixed(3), '-i', source, '-an',
|
|
150
|
+
'-c:v', 'libx264', '-crf', '18', '-preset', 'veryfast', '-pix_fmt', 'yuv420p', '-movflags', '+faststart', clip],
|
|
151
|
+
{ cwd: folder, timeoutMs: 300000, log: join(exportRoot(dir), 'ff.log') })
|
|
152
|
+
if (!existsSync(clip)) throw new Error('第 ' + (index + 1) + ' 镜切失败:' + shot.id)
|
|
153
|
+
shots.push({ id: shot.id, card: shot.card || null, from: round(from), to: round(to), seconds: round(to - from),
|
|
154
|
+
startFrame: shot.startFrame, durationFrames: shot.durationFrames, clip: 'clips/' + shot.id + '.mp4' })
|
|
155
|
+
onProgress?.({ stage: 'clips', index: index + 1, total: timeline.shots.length })
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const stems = []
|
|
159
|
+
const missing = []
|
|
160
|
+
for (const cue of (Array.isArray(timeline.audio) ? timeline.audio : [])) {
|
|
161
|
+
if (!cue.file) continue
|
|
162
|
+
const from = join(dir, 'assets', cue.file)
|
|
163
|
+
if (!existsSync(from)) { missing.push(cue.file); continue }
|
|
164
|
+
const target = join(folder, 'audio', cue.role + '-' + (stems.length + 1) + (extname(cue.file) || '.mp3'))
|
|
165
|
+
copyFileSync(from, target)
|
|
166
|
+
stems.push({
|
|
167
|
+
role: cue.role || 'sfx', source: 'audio/' + basename(target), at: round(Number(cue.from || 0) / fps),
|
|
168
|
+
seconds: round(Number(cue.durationInFrames || 0) / fps), gainDb: Number(cue.gainDb || 0),
|
|
169
|
+
fadeIn: round(Number(cue.fadeIn || 0) / fps), fadeOut: round(Number(cue.fadeOut || 0) / fps),
|
|
170
|
+
loop: Boolean(cue.loop), duck: Boolean(cue.duck),
|
|
171
|
+
})
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const rows = subtitleRows(timeline, subtitles)
|
|
175
|
+
if (rows.length) writeFileSync(join(folder, 'subtitles.srt'), srtSource(rows), 'utf8')
|
|
176
|
+
copyFileSync(source, join(folder, 'film.mp4'))
|
|
177
|
+
writeFileSync(join(folder, 'shots.json'), JSON.stringify({
|
|
178
|
+
width: timeline.width, height: timeline.height, fps,
|
|
179
|
+
durationInFrames: timeline.durationInFrames, seconds: round(Number(timeline.durationInFrames) / fps), shots,
|
|
180
|
+
}, null, 2) + '\n', 'utf8')
|
|
181
|
+
writeFileSync(join(folder, 'audio.json'), JSON.stringify({ fps, cues: stems, missing }, null, 2) + '\n', 'utf8')
|
|
182
|
+
|
|
183
|
+
let draftFile = null
|
|
184
|
+
if (draft) {
|
|
185
|
+
const content = jianyingDraft({ timeline, shots, stems, subtitles: rows, folder })
|
|
186
|
+
draftFile = join(folder, 'draft_content.json')
|
|
187
|
+
writeFileSync(draftFile, JSON.stringify(content, null, 2) + '\n', 'utf8')
|
|
188
|
+
}
|
|
189
|
+
writeFileSync(join(folder, 'README.md'), readmeOf({ timeline, shots, stems, subtitles: rows.length, missing }), 'utf8')
|
|
190
|
+
rmSync(join(folder, 'ff.log'), { force: true })
|
|
191
|
+
return { folder, shots, stems, subtitles: rows.length, draft: draftFile, missing,
|
|
192
|
+
seconds: round(Number(timeline.durationInFrames) / fps), files: 2 + shots.length + stems.length + (rows.length ? 1 : 0) + (draftFile ? 1 : 0) }
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export function listExports(dir) {
|
|
196
|
+
const root = exportRoot(dir)
|
|
197
|
+
if (!existsSync(root)) return []
|
|
198
|
+
return readdirSync(root, { withFileTypes: true }).filter((entry) => entry.isDirectory())
|
|
199
|
+
.map((entry) => ({ name: entry.name, folder: join(root, entry.name), at: statSync(join(root, entry.name)).mtime.toISOString() }))
|
|
200
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// ffmpeg 调用:stderr 写文件,不走管道。
|
|
2
|
+
//
|
|
3
|
+
// 受限环境下 spawn + pipe 会直接 EPERM(拿不到匿名管道),而文件描述符不受
|
|
4
|
+
// 影响;顺带也绕开了 execFile 的 maxBuffer 上限。帧检和导出都走这一个入口。
|
|
5
|
+
|
|
6
|
+
import { existsSync, openSync, closeSync, readFileSync } from 'node:fs'
|
|
7
|
+
import { join, isAbsolute } from 'node:path'
|
|
8
|
+
import { spawn } from 'node:child_process'
|
|
9
|
+
import { ffmpegBinary } from '../video-export.js'
|
|
10
|
+
|
|
11
|
+
export function runFfmpeg(args, options = {}) {
|
|
12
|
+
const cwd = options.cwd || process.cwd()
|
|
13
|
+
const logPath = isAbsolute(options.log || '') ? options.log : join(cwd, options.log || 'ff.log')
|
|
14
|
+
return new Promise((resolve, reject) => {
|
|
15
|
+
let fd
|
|
16
|
+
try {
|
|
17
|
+
fd = openSync(logPath, 'w')
|
|
18
|
+
} catch (error) {
|
|
19
|
+
reject(error)
|
|
20
|
+
return
|
|
21
|
+
}
|
|
22
|
+
const child = spawn(ffmpegBinary(), ['-hide_banner', '-nostdin', '-y', ...args], {
|
|
23
|
+
cwd, windowsHide: true, stdio: ['ignore', 'ignore', fd],
|
|
24
|
+
})
|
|
25
|
+
const timer = setTimeout(() => child.kill(), options.timeoutMs || 300000)
|
|
26
|
+
const finish = (code, error) => {
|
|
27
|
+
clearTimeout(timer)
|
|
28
|
+
try { closeSync(fd) } catch { /* 已关 */ }
|
|
29
|
+
let stderr = ''
|
|
30
|
+
try { stderr = readFileSync(logPath, 'utf8') } catch { /* 没有日志 */ }
|
|
31
|
+
if (error) reject(Object.assign(error, { stderr }))
|
|
32
|
+
else if (code === 0 || options.allowFail) resolve(stderr)
|
|
33
|
+
else reject(Object.assign(new Error('ffmpeg 退出码 ' + code + ':' + stderr.trim().split('\n').slice(-2).join(' ')), { stderr }))
|
|
34
|
+
}
|
|
35
|
+
child.on('error', (error) => finish(-1, error))
|
|
36
|
+
child.on('close', (code) => finish(code))
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function ffmpegAvailable() {
|
|
41
|
+
return existsSync(ffmpegBinary())
|
|
42
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// Fonts copied into a video project's public assets.
|
|
2
|
+
//
|
|
3
|
+
// 字体不在 npm 包里(约 135MB),由 asset-pack.js 解析:开发目录里直接用,安装版从
|
|
4
|
+
// `~/.dsh/drawai-assets/` 读(首次使用自动下载)。所以这里**不能在模块导入期读文件**,
|
|
5
|
+
// 一律走 fontFaces() 之类的函数,缺素材时由调用方 catch 并提示用户。
|
|
6
|
+
import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync } from 'node:fs'
|
|
7
|
+
import { join } from 'node:path'
|
|
8
|
+
import { fileURLToPath } from 'node:url'
|
|
9
|
+
|
|
10
|
+
import { fontsDir } from './asset-pack.js'
|
|
11
|
+
|
|
12
|
+
const BASIC_FAMILIES = new Set(['Noto Sans SC', 'Noto Serif SC'])
|
|
13
|
+
let cachedFaces = null
|
|
14
|
+
|
|
15
|
+
/** 内置字体清单(font-faces.json)。素材没装好时返回空数组。 */
|
|
16
|
+
export function fontFaces() {
|
|
17
|
+
if (cachedFaces) return cachedFaces
|
|
18
|
+
const dir = fontsDir()
|
|
19
|
+
if (!dir) return []
|
|
20
|
+
const file = join(dir, 'font-faces.json')
|
|
21
|
+
if (!existsSync(file)) return []
|
|
22
|
+
cachedFaces = JSON.parse(readFileSync(file, 'utf8')).faces || []
|
|
23
|
+
return cachedFaces
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** 字体文件名列表(缺素材时为空)。 */
|
|
27
|
+
export function bundledFontNames() {
|
|
28
|
+
return fontFaces().map(face => face.file)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function referencedFamilies(projectDir) {
|
|
32
|
+
let text = ''
|
|
33
|
+
function visit(dir) {
|
|
34
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
35
|
+
if (entry.isDirectory()) {
|
|
36
|
+
if (!['assets', '.out', 'node_modules', '.git'].includes(entry.name)) visit(join(dir, entry.name))
|
|
37
|
+
} else if (entry.isFile() && /\.(?:[cm]?[jt]sx?|css)$/i.test(entry.name)) {
|
|
38
|
+
text += '\n' + readFileSync(join(dir, entry.name), 'utf8')
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
visit(projectDir)
|
|
43
|
+
const normalized = text.toLowerCase().replace(/[^a-z0-9]/g, '')
|
|
44
|
+
return new Set(fontFaces().filter(face => normalized.includes(face.family.toLowerCase().replace(/[^a-z0-9]/g, ''))).map(face => face.family))
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function writeBundledFonts(projectDir) {
|
|
48
|
+
const root = fontsDir()
|
|
49
|
+
if (!root) throw new Error('动效素材包还没就绪(缺字体目录):请先让插件下载素材包')
|
|
50
|
+
const dest = join(projectDir, 'assets', 'fonts')
|
|
51
|
+
mkdirSync(dest, { recursive: true })
|
|
52
|
+
const needed = referencedFamilies(projectDir)
|
|
53
|
+
for (const face of fontFaces()) {
|
|
54
|
+
if (!BASIC_FAMILIES.has(face.family) && !needed.has(face.family)) continue
|
|
55
|
+
const name = face.file
|
|
56
|
+
const source = join(root, name), target = join(dest, name)
|
|
57
|
+
if (!existsSync(source)) throw new Error('插件缺少内置字体:' + name)
|
|
58
|
+
if (!existsSync(target)) copyFileSync(source, target)
|
|
59
|
+
}
|
|
60
|
+
const notices = fileURLToPath(new URL('../../LICENSE', import.meta.url))
|
|
61
|
+
const targetNotice = join(dest, 'DRAWAI-NOTICES.txt')
|
|
62
|
+
if (existsSync(notices) && !existsSync(targetNotice)) copyFileSync(notices, targetNotice)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function hasBundledFonts(projectDir) {
|
|
66
|
+
return fontFaces().filter(face => BASIC_FAMILIES.has(face.family)).every(face => existsSync(join(projectDir, 'assets', 'fonts', face.file)))
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function availableBundledFontFaces(projectDir) {
|
|
70
|
+
return fontFaces().filter(face => existsSync(join(projectDir, 'assets', 'fonts', face.file)))
|
|
71
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// 异步任务表:让"开始渲染"立刻返回,把等待交给下一次工具调用。
|
|
2
|
+
//
|
|
3
|
+
// 之前 58 分钟里有 24.8 分钟是一次次 `Start-Sleep 100` 睡出来的。
|
|
4
|
+
// 规矩很简单:任何超过 5 秒的动作都返回 jobId,绝不 await 到结束。
|
|
5
|
+
|
|
6
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
|
|
7
|
+
import { join } from 'node:path'
|
|
8
|
+
import { parseProjectJson } from './json.js'
|
|
9
|
+
|
|
10
|
+
let sequence = 0
|
|
11
|
+
|
|
12
|
+
export class RenderJobs {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.jobs = new Map()
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
file(dir) {
|
|
18
|
+
return join(dir, '.out', 'jobs.json')
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
load(dir) {
|
|
22
|
+
try {
|
|
23
|
+
if (!existsSync(this.file(dir))) return []
|
|
24
|
+
const raw = parseProjectJson(readFileSync(this.file(dir), 'utf8'))
|
|
25
|
+
return Array.isArray(raw) ? raw : []
|
|
26
|
+
} catch { return [] }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
save(job) {
|
|
30
|
+
const dir = job.dir
|
|
31
|
+
if (!dir) return
|
|
32
|
+
mkdirSync(join(dir, '.out'), { recursive: true })
|
|
33
|
+
const list = this.load(dir).filter((item) => item.id !== job.id)
|
|
34
|
+
list.push(job)
|
|
35
|
+
writeFileSync(this.file(dir), JSON.stringify(list.slice(-40), null, 2) + '\n', 'utf8')
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
create(init) {
|
|
39
|
+
sequence += 1
|
|
40
|
+
const job = {
|
|
41
|
+
id: 'job-' + Date.now().toString(36) + '-' + sequence,
|
|
42
|
+
kind: init.kind || 'render',
|
|
43
|
+
dir: init.dir,
|
|
44
|
+
nodeId: init.nodeId,
|
|
45
|
+
status: 'queued',
|
|
46
|
+
phase: 'queued',
|
|
47
|
+
progress: 0,
|
|
48
|
+
createdAt: new Date().toISOString(),
|
|
49
|
+
endedAt: null,
|
|
50
|
+
output: null,
|
|
51
|
+
error: null,
|
|
52
|
+
}
|
|
53
|
+
this.jobs.set(job.id, job)
|
|
54
|
+
this.save(job)
|
|
55
|
+
return job
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
update(job, patch) {
|
|
59
|
+
Object.assign(job, patch)
|
|
60
|
+
this.save(job)
|
|
61
|
+
return job
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// 进度只在内存里刷:每 1% 写一次盘既慢又没意义。
|
|
65
|
+
progress(job, phase, value) {
|
|
66
|
+
if (phase) job.phase = phase
|
|
67
|
+
if (Number.isFinite(value)) job.progress = value
|
|
68
|
+
return job
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// 把一次 renderProject 的句柄挂到 job 上,状态变化全部写回表。
|
|
72
|
+
attach(job, handle) {
|
|
73
|
+
job._cancel = handle.cancel
|
|
74
|
+
this.update(job, { status: 'running', phase: 'bundling' })
|
|
75
|
+
handle.promise.then(
|
|
76
|
+
(result) => this.update(job, { status: 'done', phase: 'done', progress: 1, endedAt: new Date().toISOString(), output: handle.output, frames: result.frames || null,
|
|
77
|
+
mix: result.mix || null, mixError: result.mixError || null }),
|
|
78
|
+
(error) => this.update(job, { status: 'failed', phase: 'failed', endedAt: new Date().toISOString(), error: error.message || String(error) }),
|
|
79
|
+
)
|
|
80
|
+
return job
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
get(id) {
|
|
84
|
+
return this.jobs.get(id) || null
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
list(dir) {
|
|
88
|
+
const fromDisk = this.load(dir)
|
|
89
|
+
const height = new Map(fromDisk.map((item) => [item.id, item]))
|
|
90
|
+
for (const job of this.jobs.values()) if (job.dir === dir) height.set(job.id, { ...job, _cancel: undefined })
|
|
91
|
+
return [...height.values()].sort((a, b) => String(b.createdAt).localeCompare(String(a.createdAt)))
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
cancel(id) {
|
|
95
|
+
const job = this.jobs.get(id)
|
|
96
|
+
if (!job) return false
|
|
97
|
+
job._cancel?.()
|
|
98
|
+
this.update(job, { status: 'canceled', phase: 'canceled', endedAt: new Date().toISOString() })
|
|
99
|
+
return true
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* 回填时该取哪一种任务。主视频节点(建过工程的)等的是整片 film;
|
|
105
|
+
* 另建的「样片」节点等的是 pilot。调用方显式给了 source 就以它为准。
|
|
106
|
+
*
|
|
107
|
+
* 以前没有这个区分:apply 只找"最新一版 film",而样片 range 渲染写的也是 film.mp4,
|
|
108
|
+
* 于是 4 秒样片会被当成整片写进主节点。
|
|
109
|
+
*/
|
|
110
|
+
export function applyJobKind({ source, targetHasProject }) {
|
|
111
|
+
if (source === 'pilot' || source === 'film') return source
|
|
112
|
+
return targetHasProject ? 'film' : 'pilot'
|
|
113
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Bundled upstream media. Only requested files are copied into a project.
|
|
2
|
+
import { createHash } from 'node:crypto'
|
|
3
|
+
import { existsSync, readFileSync } from 'node:fs'
|
|
4
|
+
import { join } from 'node:path'
|
|
5
|
+
import { mediaLibraryRoot } from './asset-pack.js'
|
|
6
|
+
import { captureAsset, readAssets, writeAssets } from './assets.js'
|
|
7
|
+
|
|
8
|
+
// 素材库不在 npm 包里,位置由 asset-pack 解析;没装好时这些查询返回空。
|
|
9
|
+
const root = () => mediaLibraryRoot()
|
|
10
|
+
const indexPath = () => join(root() || '', 'upstream-files.json')
|
|
11
|
+
const checksumPath = () => join(root() || '', 'checksums.sha256.json')
|
|
12
|
+
const commit = '49052d80bfaf9fa8412cc9710530e5e95a3b8d8c'
|
|
13
|
+
const labels = { paper:'纸张', grain:'颗粒', dust:'灰尘', washi:'胶带', piano:'钢琴', harp:'竖琴', glock:'钟琴', marimba:'马林巴', kalimba:'拇指琴', vibraphone:'颤音琴', timpani:'定音鼓', woodblock:'木鱼', crash:'镲', suscymbal:'吊镲', cabasa:'卡巴萨', guiro:'刮胡', slapstick:'拍板', vibraslap:'颤响器', wineglass:'酒杯' }
|
|
14
|
+
|
|
15
|
+
export function listMediaLibrary({ query = '', category = '' } = {}) {
|
|
16
|
+
if (!existsSync(indexPath())) return []
|
|
17
|
+
const index = JSON.parse(readFileSync(indexPath(), 'utf8'))
|
|
18
|
+
if (index.commit !== commit || !Array.isArray(index.files)) throw new Error('内置素材库索引无效')
|
|
19
|
+
const q = String(query).trim().toLowerCase(), cat = String(category).trim().toLowerCase()
|
|
20
|
+
return index.files.map(item => {
|
|
21
|
+
if (typeof item.path !== 'string' || item.path.split('/').some(part => !part || part === '.' || part === '..' || part.includes('\\'))) throw new Error('内置素材库路径无效')
|
|
22
|
+
const image = item.path.startsWith('assets/textures/')
|
|
23
|
+
const audio = item.path.startsWith('lib/audio/samples/') && item.path.endsWith('.flac')
|
|
24
|
+
if (!image && !audio) throw new Error('内置素材库路径无效')
|
|
25
|
+
const group = item.path.split('/')[image ? 2 : 3], name = item.path.split('/').at(-1)
|
|
26
|
+
return { id: item.path, name, category: group, categoryName: labels[group] || group,
|
|
27
|
+
kind: image ? 'image' : 'audio', bytes: item.size, gitSha: item.sha,
|
|
28
|
+
license: audio || name === 'Paper001_4K_color.jpg' ? 'CC0-1.0' : '上游未逐项列明',
|
|
29
|
+
source: 'https://github.com/Vincentwei1021/mg-styles-15/blob/' + commit + '/' + item.path.split('/').map(encodeURIComponent).join('/') }
|
|
30
|
+
}).filter(item => existsSync(join(root() || '', ...item.id.split('/'))))
|
|
31
|
+
.filter(item => (!cat || [item.category, item.categoryName, item.kind].some(v => v.toLowerCase() === cat))
|
|
32
|
+
&& (!q || [item.name, item.category, item.categoryName, item.id].some(v => v.toLowerCase().includes(q))))
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export async function importMediaLibrary(projectDir, id) {
|
|
36
|
+
const item = listMediaLibrary().find(entry => entry.id === id)
|
|
37
|
+
if (!item) throw new Error('未找到内置素材,请先使用 motion_assets library 获取 id')
|
|
38
|
+
const file = join(root() || '', ...item.id.split('/'))
|
|
39
|
+
if (!existsSync(file)) throw new Error('插件素材文件缺失:' + item.id)
|
|
40
|
+
const data = readFileSync(file)
|
|
41
|
+
const hash = createHash('sha1').update(`blob ${data.length}\0`).update(data).digest('hex')
|
|
42
|
+
const sha256 = createHash('sha256').update(data).digest('hex')
|
|
43
|
+
const upstreamMatches = data.length === item.bytes && hash === item.gitSha
|
|
44
|
+
let expectedSha256 = null
|
|
45
|
+
try { expectedSha256 = JSON.parse(readFileSync(checksumPath(), 'utf8')).files[item.id]?.sha256 || null } catch { /* optional diagnostic manifest */ }
|
|
46
|
+
const warnings = []
|
|
47
|
+
if (!upstreamMatches) warnings.push('素材与上游 Git SHA-1 或大小不一致,已按本地实际文件导入')
|
|
48
|
+
if (expectedSha256 && expectedSha256 !== sha256) warnings.push('素材与插件 SHA-256 校验清单不一致,已按本地实际文件导入')
|
|
49
|
+
if (!expectedSha256) warnings.push('插件 SHA-256 校验清单缺少该素材')
|
|
50
|
+
const license = upstreamMatches ? item.license : '未确认(本地内容与上游记录不一致)'
|
|
51
|
+
const source = upstreamMatches ? item.source : '插件内置文件(上游参考:' + item.source + ')'
|
|
52
|
+
const entry = await captureAsset(projectDir, file, { source, license,
|
|
53
|
+
caption: `${item.categoryName}: ${item.name}(${license})` })
|
|
54
|
+
const integrity = { sha256, expectedSha256, gitSha1: hash, expectedGitSha1: item.gitSha, warnings }
|
|
55
|
+
const manifest = readAssets(projectDir)
|
|
56
|
+
const saved = manifest.items.find(value => value.file === entry.file)
|
|
57
|
+
if (saved) { saved.libraryId = item.id; saved.integrity = integrity; saved.source = source; saved.license = license; writeAssets(projectDir, manifest) }
|
|
58
|
+
return { ...entry, source, libraryId: item.id, license, integrity }
|
|
59
|
+
}
|