Commit d27f3e1a authored by Chunchi Che's avatar Chunchi Che

update focus animation, use translation when in hand or deck

parent b4e4a4e8
import { config } from "@react-spring/web";
import { ygopro } from "@/api"; import { ygopro } from "@/api";
import { type CardType, matStore } from "@/stores"; import { type CardType, matStore } from "@/stores";
...@@ -9,10 +7,23 @@ import { asyncStart } from "./utils"; ...@@ -9,10 +7,23 @@ import { asyncStart } from "./utils";
/** 发动效果的动画 */ /** 发动效果的动画 */
export const focus = async (props: { card: CardType; api: SpringApi }) => { export const focus = async (props: { card: CardType; api: SpringApi }) => {
const { card, api } = props; const { card, api } = props;
await asyncStart(api)({ if (
focusScale: 1.5, card.location.zone == ygopro.CardZone.HAND ||
focusDisplay: "block", card.location.zone == ygopro.CardZone.DECK
focusOpacity: 0, ) {
}); const current = api.current[0].get();
api.set({ focusScale: 1, focusOpacity: 1, focusDisplay: "none" }); await asyncStart(api)({
y: current.y + (matStore.isMe(card.location.controller) ? -1 : 1) * 200, // TODO: 放到config之中
ry: 0,
rz: 0,
});
await asyncStart(api)({ y: current.y, ry: current.ry, rz: current.rz });
} else {
await asyncStart(api)({
focusScale: 1.5,
focusDisplay: "block",
focusOpacity: 0,
});
api.set({ focusScale: 1, focusOpacity: 1, focusDisplay: "none" });
}
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment