feat:自动小动作仅在动画分区开启
This commit is contained in:
@@ -69,6 +69,10 @@
|
|||||||
this.driven = !!opts.driven;
|
this.driven = !!opts.driven;
|
||||||
this.paused = !!opts.paused;
|
this.paused = !!opts.paused;
|
||||||
this.reduceMotion = opts.reduceMotion ?? (typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches);
|
this.reduceMotion = opts.reduceMotion ?? (typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches);
|
||||||
|
// autoTricks gates the AUTOMATIC spin sources (wantPn, celebrate re-arm,
|
||||||
|
// idle trick loop, shape-change trick). State-inherent rotation
|
||||||
|
// (humming/loading ovSpin) and explicit spinOnce stay untouched.
|
||||||
|
this.autoTricks = opts.autoTricks !== false;
|
||||||
this.badgeColor = opts.badgeColor || "var(--gb-badge, #1d9bf0)";
|
this.badgeColor = opts.badgeColor || "var(--gb-badge, #1d9bf0)";
|
||||||
this.sizePx = opts.sizePx || null;
|
this.sizePx = opts.sizePx || null;
|
||||||
this.eyeColor = opts.eyeColor || null;
|
this.eyeColor = opts.eyeColor || null;
|
||||||
@@ -642,6 +646,10 @@
|
|||||||
this.playlistHold = next;
|
this.playlistHold = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setAutoTricks(on) {
|
||||||
|
this.autoTricks = !!on;
|
||||||
|
}
|
||||||
|
|
||||||
playback() {
|
playback() {
|
||||||
const remain = this.playlistHold
|
const remain = this.playlistHold
|
||||||
? (this.eyeRemain || 0)
|
? (this.eyeRemain || 0)
|
||||||
@@ -893,7 +901,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
_cycleShapeTrick() {
|
_cycleShapeTrick() {
|
||||||
if (this.reduceMotion || this.paused || this.driven || this.manualHold) return;
|
if (this.reduceMotion || this.paused || this.driven || this.manualHold || !this.autoTricks) return;
|
||||||
this.trickCycle = (this.trickCycle + 1) % 5;
|
this.trickCycle = (this.trickCycle + 1) % 5;
|
||||||
this.wildWide = false;
|
this.wildWide = false;
|
||||||
if (this.trickCycle === 0) this._pn(1);
|
if (this.trickCycle === 0) this._pn(1);
|
||||||
@@ -1039,7 +1047,7 @@
|
|||||||
this.ctx.wantBlink = false;
|
this.ctx.wantBlink = false;
|
||||||
}
|
}
|
||||||
if (!this.manualHold && this.ctx.wantPn) {
|
if (!this.manualHold && this.ctx.wantPn) {
|
||||||
this._pn(...this.ctx.wantPn);
|
if (this.autoTricks) this._pn(...this.ctx.wantPn);
|
||||||
this.ctx.wantPn = null;
|
this.ctx.wantPn = null;
|
||||||
}
|
}
|
||||||
if (!this.manualHold && this.ctx.wantBurst) {
|
if (!this.manualHold && this.ctx.wantBurst) {
|
||||||
@@ -1059,12 +1067,12 @@
|
|||||||
this._stepOverlay(now);
|
this._stepOverlay(now);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.manualHold && this.celebrateAt > 0 && now >= this.celebrateAt && !this.trick) {
|
if (this.autoTricks && !this.manualHold && this.celebrateAt > 0 && now >= this.celebrateAt && !this.trick) {
|
||||||
this.trick = TR.startTrick("spinWild", this.reduceMotion || this.paused);
|
this.trick = TR.startTrick("spinWild", this.reduceMotion || this.paused);
|
||||||
this.celebrateAt = now + 6200;
|
this.celebrateAt = now + 6200;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.driven && !this.manualHold && now >= this.trickAt) {
|
if (this.autoTricks && !this.driven && !this.manualHold && now >= this.trickAt) {
|
||||||
if ((V_T.has(this.state) || B_T.has(this.state)) && !this.spinTurn && this.hopAt < 0 && !this.trick) {
|
if ((V_T.has(this.state) || B_T.has(this.state)) && !this.spinTurn && this.hopAt < 0 && !this.trick) {
|
||||||
const z = Math.random();
|
const z = Math.random();
|
||||||
if (V_T.has(this.state)) {
|
if (V_T.has(this.state)) {
|
||||||
|
|||||||
@@ -127,6 +127,7 @@ const cycle = computed(() => cycles.value.find((c) => c.id === activeId.value) ?
|
|||||||
const state = ref(intro.value ? 'idle' : (cycle.value.blocks[block.value]?.state ?? 'idle'))
|
const state = ref(intro.value ? 'idle' : (cycle.value.blocks[block.value]?.state ?? 'idle'))
|
||||||
|
|
||||||
const gauche = computed(() => view.value === 'reglages' && !preview.value)
|
const gauche = computed(() => view.value === 'reglages' && !preview.value)
|
||||||
|
const autoTricks = computed(() => view.value === 'animations')
|
||||||
const droite = computed(() => view.value !== 'reglages' && !preview.value && !intro.value)
|
const droite = computed(() => view.value !== 'reglages' && !preview.value && !intro.value)
|
||||||
const plein = computed(() => preview.value || photo.value)
|
const plein = computed(() => preview.value || photo.value)
|
||||||
const follow = computed(() => view.value === 'reglages' && !preview.value)
|
const follow = computed(() => view.value === 'reglages' && !preview.value)
|
||||||
@@ -740,6 +741,7 @@ onUnmounted(() => {
|
|||||||
:echelle="photo ? photoComposition.scale : 1"
|
:echelle="photo ? photoComposition.scale : 1"
|
||||||
:playing="posePlay"
|
:playing="posePlay"
|
||||||
:mix="poseMix"
|
:mix="poseMix"
|
||||||
|
:auto-tricks="autoTricks"
|
||||||
@ready="onHeroReady"
|
@ready="onHeroReady"
|
||||||
@update:manual="manual = $event"
|
@update:manual="manual = $event"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ const props = withDefaults(
|
|||||||
playing?: boolean
|
playing?: boolean
|
||||||
mix?: number
|
mix?: number
|
||||||
echelle?: number
|
echelle?: number
|
||||||
|
autoTricks?: boolean
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
size: 440,
|
size: 440,
|
||||||
@@ -30,7 +31,8 @@ const props = withDefaults(
|
|||||||
tools: false,
|
tools: false,
|
||||||
playing: false,
|
playing: false,
|
||||||
mix: 0,
|
mix: 0,
|
||||||
echelle: 1
|
echelle: 1,
|
||||||
|
autoTricks: true
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -125,6 +127,7 @@ defineExpose({
|
|||||||
:state="state"
|
:state="state"
|
||||||
:follow="follow && !active"
|
:follow="follow && !active"
|
||||||
:paper="paper"
|
:paper="paper"
|
||||||
|
:auto-tricks="autoTricks"
|
||||||
@ready="onReady"
|
@ready="onReady"
|
||||||
/>
|
/>
|
||||||
<ManualCanvas
|
<ManualCanvas
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ const props = withDefaults(
|
|||||||
state?: string
|
state?: string
|
||||||
follow?: boolean
|
follow?: boolean
|
||||||
paper?: string
|
paper?: string
|
||||||
|
autoTricks?: boolean
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
size: 440,
|
size: 440,
|
||||||
@@ -18,7 +19,8 @@ const props = withDefaults(
|
|||||||
color: 'black',
|
color: 'black',
|
||||||
state: 'idle',
|
state: 'idle',
|
||||||
follow: false,
|
follow: false,
|
||||||
paper: '#f9f9f9'
|
paper: '#f9f9f9',
|
||||||
|
autoTricks: true
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -37,7 +39,8 @@ function input() {
|
|||||||
color: props.color,
|
color: props.color,
|
||||||
follow: props.follow,
|
follow: props.follow,
|
||||||
paper: props.paper,
|
paper: props.paper,
|
||||||
size: props.size
|
size: props.size,
|
||||||
|
autoTricks: props.autoTricks
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +69,7 @@ onBeforeUnmount(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => [props.state, props.shape, props.color, props.follow, props.paper, props.size],
|
() => [props.state, props.shape, props.color, props.follow, props.paper, props.size, props.autoTricks],
|
||||||
() => replica?.apply(input())
|
() => replica?.apply(input())
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ export type ReplicaBot = {
|
|||||||
setSize: (px: number) => void
|
setSize: (px: number) => void
|
||||||
seekEye: (index: number, opts?: { snap?: boolean }) => void
|
seekEye: (index: number, opts?: { snap?: boolean }) => void
|
||||||
setPlaylistHold: (on: boolean) => void
|
setPlaylistHold: (on: boolean) => void
|
||||||
|
setAutoTricks: (on: boolean) => void
|
||||||
playback: () => ReplicaPlayback
|
playback: () => ReplicaPlayback
|
||||||
destroy: () => void
|
destroy: () => void
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-1
@@ -36,6 +36,7 @@ export type ReplicaInput = {
|
|||||||
paper: string
|
paper: string
|
||||||
size: number
|
size: number
|
||||||
eye?: number
|
eye?: number
|
||||||
|
autoTricks?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const TILE_MAX = 6
|
const TILE_MAX = 6
|
||||||
@@ -118,7 +119,8 @@ export async function mountReplica(
|
|||||||
eyeColor: input.paper,
|
eyeColor: input.paper,
|
||||||
paused: driven ? false : live ? false : 'hold-pose',
|
paused: driven ? false : live ? false : 'hold-pose',
|
||||||
driven,
|
driven,
|
||||||
eyeIndex: input.eye
|
eyeIndex: input.eye,
|
||||||
|
autoTricks: input.autoTricks ?? true
|
||||||
})
|
})
|
||||||
const noop = {
|
const noop = {
|
||||||
apply: () => {},
|
apply: () => {},
|
||||||
@@ -154,6 +156,8 @@ export async function mountReplica(
|
|||||||
if (next.follow !== last.follow) bot.setFollowPointer(next.follow)
|
if (next.follow !== last.follow) bot.setFollowPointer(next.follow)
|
||||||
if (next.paper !== last.paper) bot.setEyeColor(next.paper)
|
if (next.paper !== last.paper) bot.setEyeColor(next.paper)
|
||||||
if (next.size !== last.size) bot.setSize(next.size)
|
if (next.size !== last.size) bot.setSize(next.size)
|
||||||
|
if ((next.autoTricks ?? true) !== (last.autoTricks ?? true))
|
||||||
|
bot.setAutoTricks(next.autoTricks ?? true)
|
||||||
last = { ...next }
|
last = { ...next }
|
||||||
},
|
},
|
||||||
spin: () => bot.spinOnce(1),
|
spin: () => bot.spinOnce(1),
|
||||||
|
|||||||
Reference in New Issue
Block a user