forked from 27hrs/dsh-long-skin
refactor: make Liang skin image-only
This commit is contained in:
@@ -138,7 +138,7 @@ npm run build
|
||||
|
||||
## 灵感与素材来源
|
||||
|
||||
本插件的“滑动变祖”视觉概念、人物图片与插帧视频素材源自
|
||||
本插件的“滑动变祖”视觉概念与人物图片素材源自
|
||||
[Lichtspektrum/liang-intensity-calibrator](https://github.com/Lichtspektrum/liang-intensity-calibrator)。插件在原项目 0–30 强度轴的基础上,将视觉变化接入 DeepSeek Harness 的推理等级选择。
|
||||
|
||||
运行时素材已包含在插件中,安装后不需要额外下载。当前接入 24 张经过审核的人像锚点,滑动时直接切换最近锚点,不做图片交叉渐变。
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
# 滑动变祖 · 人像与视频生成交接
|
||||
# 滑动变祖 · 人像生成交接
|
||||
|
||||
## 结论
|
||||
|
||||
@@ -6,18 +6,17 @@
|
||||
- 已生成:**24 / 24**
|
||||
- 分辨率与色彩:**1024 × 1024,RGB**
|
||||
- 生成图目录:`packages/dsh-client-liang-intensity-skin/assets/portrait-source-v2/`
|
||||
- 原视频关键帧目录:`packages/dsh-client-liang-intensity-skin/assets/portrait-source-v2/references/`
|
||||
- 原视频:`packages/dsh-client-liang-intensity-skin/assets/liang-evolution.webm`
|
||||
- 阶段参考图目录:`packages/dsh-client-liang-intensity-skin/assets/portrait-source-v2/references/`
|
||||
|
||||
`stage-low.png`、`stage-mid.png`、`stage-max.png` 是早期别名。后续生图和生视频只使用表格里的 24 个规范文件名。
|
||||
`stage-low.png`、`stage-mid.png`、`stage-max.png` 是早期别名。后续只使用表格里的 24 个规范文件名。
|
||||
|
||||
## 公共提示词
|
||||
|
||||
下面这段作为每张图的公共提示词。把大括号变量替换为表格中对应内容;阶段服装、表情和装饰必须以该阶段原视频关键帧为准。
|
||||
下面这段作为每张图的公共提示词。把大括号变量替换为表格中对应内容;阶段服装、表情和装饰必须以该阶段参考图为准。
|
||||
|
||||
```text
|
||||
Use case: identity-preserve
|
||||
Asset type: square key portrait for a continuous image-to-video character evolution sequence
|
||||
Asset type: square key portrait for a continuous portrait evolution sequence
|
||||
|
||||
Primary request:
|
||||
Using {REFERENCE_FRAME} as the authoritative stage reference, create the level {LEVEL} key portrait of the same Chinese adult man. Preserve his identity exactly: facial structure, glasses, hairstyle, skin tone, age, eye spacing, nose, mouth and overall proportions. Preserve the outfit, expression, posture and stage-specific accessories shown in the authoritative reference. Do not borrow clothing or accessories from a later stage.
|
||||
@@ -65,34 +64,3 @@ No close-up crop. No cropped head, shoulders, arms or torso. No side pose. No ex
|
||||
| 24 | 30 | 8.000s | 已生成 | `stage-30.png` | `references/stage-30-8.000s.png` | 前一张 `level-29.png` |
|
||||
|
||||
所有表格路径均相对于本文件所在目录。
|
||||
|
||||
## 生视频输入顺序
|
||||
|
||||
```text
|
||||
stage-00.png
|
||||
level-01.png
|
||||
level-03.png
|
||||
level-04.png
|
||||
stage-06.png
|
||||
level-07.png
|
||||
level-09.png
|
||||
level-10.png
|
||||
stage-12.png
|
||||
level-13.png
|
||||
level-14.png
|
||||
bridge-15.png
|
||||
level-16.png
|
||||
level-17.png
|
||||
stage-18.png
|
||||
level-19.png
|
||||
level-21.png
|
||||
level-22.png
|
||||
stage-24.png
|
||||
level-25.png
|
||||
bridge-27.png
|
||||
level-28.png
|
||||
level-29.png
|
||||
stage-30.png
|
||||
```
|
||||
|
||||
视频 agent 应锁定镜头、构图和人物位置,只在相邻关键图之间做外观演化;不要加入推拉、横移、眨眼、转头、嘴部动作或随机肢体运动。输出仍按当前 UI 使用的 1:1 方形画幅制作,左侧留白和人物右移由 UI 的裁切、定位与渐变遮罩完成。
|
||||
|
||||
@@ -40,4 +40,4 @@ final result: passed
|
||||
|
||||
- 24/24 portrait sources are present at `assets/portrait-source-v2/`
|
||||
- Final contact sheet: `assets/portrait-source-v2/references/contact-sheet-final-24.png`
|
||||
- Generation/video handoff: `assets/portrait-source-v2/GENERATION-BRIEF.md`
|
||||
- Portrait generation handoff: `assets/portrait-source-v2/GENERATION-BRIEF.md`
|
||||
|
||||
@@ -42,7 +42,6 @@ body[data-liang-skin="on"] .liang-skin-backdrop {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.liang-skin-backdrop video,
|
||||
.liang-skin-backdrop img {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
@@ -63,7 +62,6 @@ body[data-liang-skin="on"] .liang-skin-backdrop {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.liang-skin-backdrop[data-media="sequence"] video,
|
||||
.liang-skin-backdrop[data-media="sequence"] .liang-skin-poster {
|
||||
display: none;
|
||||
}
|
||||
@@ -73,12 +71,6 @@ body[data-liang-skin="on"] .liang-skin-backdrop {
|
||||
opacity: var(--liang-portrait-opacity, 0.82);
|
||||
}
|
||||
|
||||
.liang-skin-backdrop[data-media="video"] .liang-skin-sequence-frame,
|
||||
.liang-skin-backdrop[data-media="video"] .liang-skin-poster {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.liang-skin-backdrop[data-media="poster"] video,
|
||||
.liang-skin-backdrop[data-media="poster"] .liang-skin-sequence-frame {
|
||||
display: none;
|
||||
}
|
||||
@@ -87,7 +79,6 @@ body[data-liang-skin="on"] .liang-skin-backdrop {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.liang-skin-backdrop[data-media="color"] video,
|
||||
.liang-skin-backdrop[data-media="color"] img {
|
||||
display: none;
|
||||
}
|
||||
@@ -652,7 +643,6 @@ body[data-liang-skin="on"] .liang-effort-control__range::-webkit-slider-thumb {
|
||||
width: 92px;
|
||||
}
|
||||
|
||||
.liang-skin-backdrop video,
|
||||
.liang-skin-backdrop img {
|
||||
right: -18vw;
|
||||
width: 92vw;
|
||||
@@ -663,7 +653,6 @@ body[data-liang-skin="on"] .liang-effort-control__range::-webkit-slider-thumb {
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.liang-skin-backdrop,
|
||||
.liang-skin-backdrop video,
|
||||
.liang-skin-backdrop img,
|
||||
body[data-liang-skin="on"] button,
|
||||
body[data-liang-skin="on"] input,
|
||||
@@ -797,7 +786,6 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
||||
var PACKAGE_ID = "dsh-client-liang-intensity-skin";
|
||||
var LOCALE_NAMESPACE = "liang.skin";
|
||||
var ASSET_PREFIX = `/plugins/${PACKAGE_ID}/assets`;
|
||||
var VIDEO_DURATION = 8.033;
|
||||
var BIND_EFFORT_KEY = "dsh-liang-intensity-skin.bind-effort";
|
||||
var PORTRAIT_ANCHORS = [
|
||||
{ level: 0, file: "stage-00.png" },
|
||||
@@ -825,6 +813,7 @@ var PORTRAIT_ANCHORS = [
|
||||
{ level: 29, file: "level-29.png" },
|
||||
{ level: 30, file: "stage-30.png" }
|
||||
];
|
||||
var ANCHOR_LEVELS = PORTRAIT_ANCHORS.map((anchor) => anchor.level);
|
||||
var cssVariables = [
|
||||
"--liang-strength",
|
||||
"--liang-page",
|
||||
@@ -846,7 +835,6 @@ var SkinPresenter = class {
|
||||
scope;
|
||||
theme;
|
||||
root;
|
||||
video;
|
||||
poster;
|
||||
portrait;
|
||||
preloads;
|
||||
@@ -866,17 +854,6 @@ var SkinPresenter = class {
|
||||
this.root.dataset.plugin = PACKAGE_ID;
|
||||
this.root.dataset.media = "sequence";
|
||||
this.root.setAttribute("aria-hidden", "true");
|
||||
this.video = document.createElement("video");
|
||||
this.video.muted = true;
|
||||
this.video.playsInline = true;
|
||||
this.video.preload = "auto";
|
||||
const webm = document.createElement("source");
|
||||
webm.src = `${ASSET_PREFIX}/liang-evolution.webm`;
|
||||
webm.type = "video/webm";
|
||||
const mp4 = document.createElement("source");
|
||||
mp4.src = `${ASSET_PREFIX}/liang-evolution.mp4`;
|
||||
mp4.type = "video/mp4";
|
||||
this.video.append(webm, mp4);
|
||||
this.poster = document.createElement("img");
|
||||
this.poster.className = "liang-skin-poster";
|
||||
this.poster.src = `${ASSET_PREFIX}/liang-poster.png`;
|
||||
@@ -885,29 +862,22 @@ var SkinPresenter = class {
|
||||
this.portrait.className = "liang-skin-sequence-frame";
|
||||
this.portrait.alt = "";
|
||||
this.portrait.draggable = false;
|
||||
this.portrait.decoding = "async";
|
||||
this.portrait.addEventListener("error", this.handleSequenceError);
|
||||
this.preloads = PORTRAIT_ANCHORS.map(({ file }) => {
|
||||
const image = new Image();
|
||||
image.decoding = "async";
|
||||
image.src = `${ASSET_PREFIX}/portrait-source-v2/${file}`;
|
||||
return image;
|
||||
});
|
||||
this.root.append(this.video, this.portrait, this.poster);
|
||||
this.root.append(this.portrait, this.poster);
|
||||
document.body.prepend(this.root);
|
||||
this.video.addEventListener("loadedmetadata", this.handleMetadata);
|
||||
this.video.addEventListener("error", this.handleVideoError);
|
||||
this.poster.addEventListener("error", this.handlePosterError);
|
||||
this.video.load();
|
||||
this.unsubscribe = scope.subscribe(() => this.syncSettings());
|
||||
this.syncSettings();
|
||||
}
|
||||
handleMetadata = () => {
|
||||
this.seek(this.frame);
|
||||
};
|
||||
handleVideoError = () => {
|
||||
this.root.dataset.media = "poster";
|
||||
};
|
||||
handleSequenceError = () => {
|
||||
this.root.dataset.media = "video";
|
||||
this.root.dataset.media = "poster";
|
||||
};
|
||||
handlePosterError = () => {
|
||||
this.root.dataset.media = "color";
|
||||
@@ -966,7 +936,6 @@ var SkinPresenter = class {
|
||||
body.style.setProperty("--liang-hover", palette.hover);
|
||||
body.style.setProperty("--liang-portrait-opacity", palette.portraitOpacity);
|
||||
this.updatePortrait(palette.level);
|
||||
this.seek(this.frame);
|
||||
}
|
||||
syncNativeTheme(theme = paletteForFrame(this.frame).stage === 5 ? "dark" : "light") {
|
||||
if (!this.enabled || this.theme.getTheme().preference === theme) return;
|
||||
@@ -975,7 +944,7 @@ var SkinPresenter = class {
|
||||
updatePortrait(level) {
|
||||
const { lowerIndex, upperIndex, mix: mix2 } = portraitBlendForLevel(
|
||||
level,
|
||||
PORTRAIT_ANCHORS.map((anchor) => anchor.level)
|
||||
ANCHOR_LEVELS
|
||||
);
|
||||
const lower = PORTRAIT_ANCHORS[lowerIndex];
|
||||
const upper = PORTRAIT_ANCHORS[upperIndex];
|
||||
@@ -983,12 +952,6 @@ var SkinPresenter = class {
|
||||
const source = `${ASSET_PREFIX}/portrait-source-v2/${selected.file}`;
|
||||
if (this.portrait.getAttribute("src") !== source) this.portrait.src = source;
|
||||
}
|
||||
seek(frame) {
|
||||
if (this.video.readyState < 1 || this.video.duration === 0) return;
|
||||
const duration = Number.isFinite(this.video.duration) ? this.video.duration : VIDEO_DURATION;
|
||||
const target = Math.min(Math.max(0, duration - 1e-3), frame / PREVIEW_MAX_FRAME * duration);
|
||||
if (Math.abs(this.video.currentTime - target) > 0.025) this.video.currentTime = target;
|
||||
}
|
||||
async choose(enabled) {
|
||||
this.setEnabled(enabled);
|
||||
try {
|
||||
@@ -1003,9 +966,6 @@ var SkinPresenter = class {
|
||||
this.disposed = true;
|
||||
this.unsubscribe();
|
||||
if (this.raf !== 0) cancelAnimationFrame(this.raf);
|
||||
this.video.pause();
|
||||
this.video.removeEventListener("loadedmetadata", this.handleMetadata);
|
||||
this.video.removeEventListener("error", this.handleVideoError);
|
||||
this.portrait.removeEventListener("error", this.handleSequenceError);
|
||||
this.poster.removeEventListener("error", this.handlePosterError);
|
||||
for (const image of this.preloads) image.src = "";
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -17,8 +17,6 @@
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"files": [
|
||||
"assets/liang-evolution.mp4",
|
||||
"assets/liang-evolution.webm",
|
||||
"assets/liang-poster.png",
|
||||
"assets/portrait-source-v2/stage-00.png",
|
||||
"assets/portrait-source-v2/level-01.png",
|
||||
|
||||
@@ -24,7 +24,6 @@ import {
|
||||
const PACKAGE_ID = "dsh-client-liang-intensity-skin";
|
||||
const LOCALE_NAMESPACE = "liang.skin";
|
||||
const ASSET_PREFIX = `/plugins/${PACKAGE_ID}/assets`;
|
||||
const VIDEO_DURATION = 8.033;
|
||||
const BIND_EFFORT_KEY = "dsh-liang-intensity-skin.bind-effort";
|
||||
|
||||
const PORTRAIT_ANCHORS = [
|
||||
@@ -54,6 +53,8 @@ const PORTRAIT_ANCHORS = [
|
||||
{ level: 30, file: "stage-30.png" },
|
||||
] as const;
|
||||
|
||||
const ANCHOR_LEVELS = PORTRAIT_ANCHORS.map((anchor) => anchor.level);
|
||||
|
||||
interface SkinSettings {
|
||||
enabled: boolean;
|
||||
bindEffort: boolean;
|
||||
@@ -139,7 +140,6 @@ class SkinPresenter {
|
||||
private readonly scope: PreferenceStore;
|
||||
private readonly theme: ThemeService;
|
||||
private readonly root: HTMLDivElement;
|
||||
private readonly video: HTMLVideoElement;
|
||||
private readonly poster: HTMLImageElement;
|
||||
private readonly portrait: HTMLImageElement;
|
||||
private readonly preloads: HTMLImageElement[];
|
||||
@@ -161,21 +161,6 @@ class SkinPresenter {
|
||||
this.root.dataset.media = "sequence";
|
||||
this.root.setAttribute("aria-hidden", "true");
|
||||
|
||||
this.video = document.createElement("video");
|
||||
this.video.muted = true;
|
||||
this.video.playsInline = true;
|
||||
this.video.preload = "auto";
|
||||
// A video poster stays painted while a paused video is scrubbed in some
|
||||
// browsers, which would make every effort show the same portrait. Keep the
|
||||
// separate image element as the true load-error fallback instead.
|
||||
const webm = document.createElement("source");
|
||||
webm.src = `${ASSET_PREFIX}/liang-evolution.webm`;
|
||||
webm.type = "video/webm";
|
||||
const mp4 = document.createElement("source");
|
||||
mp4.src = `${ASSET_PREFIX}/liang-evolution.mp4`;
|
||||
mp4.type = "video/mp4";
|
||||
this.video.append(webm, mp4);
|
||||
|
||||
this.poster = document.createElement("img");
|
||||
this.poster.className = "liang-skin-poster";
|
||||
this.poster.src = `${ASSET_PREFIX}/liang-poster.png`;
|
||||
@@ -185,35 +170,26 @@ class SkinPresenter {
|
||||
this.portrait.className = "liang-skin-sequence-frame";
|
||||
this.portrait.alt = "";
|
||||
this.portrait.draggable = false;
|
||||
this.portrait.decoding = "async";
|
||||
this.portrait.addEventListener("error", this.handleSequenceError);
|
||||
|
||||
this.preloads = PORTRAIT_ANCHORS.map(({ file }) => {
|
||||
const image = new Image();
|
||||
image.decoding = "async";
|
||||
image.src = `${ASSET_PREFIX}/portrait-source-v2/${file}`;
|
||||
return image;
|
||||
});
|
||||
|
||||
this.root.append(this.video, this.portrait, this.poster);
|
||||
this.root.append(this.portrait, this.poster);
|
||||
document.body.prepend(this.root);
|
||||
|
||||
this.video.addEventListener("loadedmetadata", this.handleMetadata);
|
||||
this.video.addEventListener("error", this.handleVideoError);
|
||||
this.poster.addEventListener("error", this.handlePosterError);
|
||||
this.video.load();
|
||||
this.unsubscribe = scope.subscribe(() => this.syncSettings());
|
||||
this.syncSettings();
|
||||
}
|
||||
|
||||
private readonly handleMetadata = () => {
|
||||
this.seek(this.frame);
|
||||
};
|
||||
|
||||
private readonly handleVideoError = () => {
|
||||
this.root.dataset.media = "poster";
|
||||
};
|
||||
|
||||
private readonly handleSequenceError = () => {
|
||||
this.root.dataset.media = "video";
|
||||
this.root.dataset.media = "poster";
|
||||
};
|
||||
|
||||
private readonly handlePosterError = () => {
|
||||
@@ -279,7 +255,6 @@ class SkinPresenter {
|
||||
body.style.setProperty("--liang-hover", palette.hover);
|
||||
body.style.setProperty("--liang-portrait-opacity", palette.portraitOpacity);
|
||||
this.updatePortrait(palette.level);
|
||||
this.seek(this.frame);
|
||||
}
|
||||
|
||||
syncNativeTheme(theme: NativeThemeId = paletteForFrame(this.frame).stage === 5 ? "dark" : "light") {
|
||||
@@ -290,7 +265,7 @@ class SkinPresenter {
|
||||
private updatePortrait(level: number) {
|
||||
const { lowerIndex, upperIndex, mix } = portraitBlendForLevel(
|
||||
level,
|
||||
PORTRAIT_ANCHORS.map((anchor) => anchor.level),
|
||||
ANCHOR_LEVELS,
|
||||
);
|
||||
const lower = PORTRAIT_ANCHORS[lowerIndex];
|
||||
const upper = PORTRAIT_ANCHORS[upperIndex];
|
||||
@@ -299,13 +274,6 @@ class SkinPresenter {
|
||||
if (this.portrait.getAttribute("src") !== source) this.portrait.src = source;
|
||||
}
|
||||
|
||||
private seek(frame: number) {
|
||||
if (this.video.readyState < 1 || this.video.duration === 0) return;
|
||||
const duration = Number.isFinite(this.video.duration) ? this.video.duration : VIDEO_DURATION;
|
||||
const target = Math.min(Math.max(0, duration - 0.001), (frame / PREVIEW_MAX_FRAME) * duration);
|
||||
if (Math.abs(this.video.currentTime - target) > 0.025) this.video.currentTime = target;
|
||||
}
|
||||
|
||||
async choose(enabled: boolean) {
|
||||
this.setEnabled(enabled);
|
||||
try {
|
||||
@@ -321,9 +289,6 @@ class SkinPresenter {
|
||||
this.disposed = true;
|
||||
this.unsubscribe();
|
||||
if (this.raf !== 0) cancelAnimationFrame(this.raf);
|
||||
this.video.pause();
|
||||
this.video.removeEventListener("loadedmetadata", this.handleMetadata);
|
||||
this.video.removeEventListener("error", this.handleVideoError);
|
||||
this.portrait.removeEventListener("error", this.handleSequenceError);
|
||||
this.poster.removeEventListener("error", this.handlePosterError);
|
||||
for (const image of this.preloads) image.src = "";
|
||||
|
||||
@@ -13,7 +13,6 @@ body[data-liang-skin="on"] .liang-skin-backdrop {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.liang-skin-backdrop video,
|
||||
.liang-skin-backdrop img {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
@@ -34,7 +33,6 @@ body[data-liang-skin="on"] .liang-skin-backdrop {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.liang-skin-backdrop[data-media="sequence"] video,
|
||||
.liang-skin-backdrop[data-media="sequence"] .liang-skin-poster {
|
||||
display: none;
|
||||
}
|
||||
@@ -44,12 +42,6 @@ body[data-liang-skin="on"] .liang-skin-backdrop {
|
||||
opacity: var(--liang-portrait-opacity, 0.82);
|
||||
}
|
||||
|
||||
.liang-skin-backdrop[data-media="video"] .liang-skin-sequence-frame,
|
||||
.liang-skin-backdrop[data-media="video"] .liang-skin-poster {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.liang-skin-backdrop[data-media="poster"] video,
|
||||
.liang-skin-backdrop[data-media="poster"] .liang-skin-sequence-frame {
|
||||
display: none;
|
||||
}
|
||||
@@ -58,7 +50,6 @@ body[data-liang-skin="on"] .liang-skin-backdrop {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.liang-skin-backdrop[data-media="color"] video,
|
||||
.liang-skin-backdrop[data-media="color"] img {
|
||||
display: none;
|
||||
}
|
||||
@@ -623,7 +614,6 @@ body[data-liang-skin="on"] .liang-effort-control__range::-webkit-slider-thumb {
|
||||
width: 92px;
|
||||
}
|
||||
|
||||
.liang-skin-backdrop video,
|
||||
.liang-skin-backdrop img {
|
||||
right: -18vw;
|
||||
width: 92vw;
|
||||
@@ -634,7 +624,6 @@ body[data-liang-skin="on"] .liang-effort-control__range::-webkit-slider-thumb {
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.liang-skin-backdrop,
|
||||
.liang-skin-backdrop video,
|
||||
.liang-skin-backdrop img,
|
||||
body[data-liang-skin="on"] button,
|
||||
body[data-liang-skin="on"] input,
|
||||
|
||||
@@ -9,8 +9,6 @@ export const SETTINGS_NAMESPACE = "liang-intensity-skin";
|
||||
export const ASSET_PREFIX = `/plugins/${PACKAGE_ID}/assets/`;
|
||||
|
||||
const ASSET_SPECS = [
|
||||
["liang-evolution.webm", "video/webm"],
|
||||
["liang-evolution.mp4", "video/mp4"],
|
||||
["liang-poster.png", "image/png"],
|
||||
["portrait-source-v2/stage-00.png", "image/png"],
|
||||
["portrait-source-v2/level-01.png", "image/png"],
|
||||
|
||||
Reference in New Issue
Block a user