installer

This commit is contained in:
Asaki Yuki 2026-01-30 01:33:05 +07:00
parent 3158c3cec8
commit 6b5cc23888
8 changed files with 127 additions and 48 deletions

View file

@ -1,40 +1,42 @@
import { AnimationKeyframe } from "../components/AnimationKeyframe.js"
import { AnimType } from "../types/enums/AnimType.js"
import { KeyframeAnimationProperties } from "../types/properties/element/Animation.js"
import { Binding } from "../types/properties/value.js"
import { AnimationKeyframe } from "../components/AnimationKeyframe.js";
import { AnimType } from "../types/enums/AnimType.js";
import { KeyframeAnimationProperties } from "../types/properties/element/Animation.js";
import { Binding } from "../types/properties/value.js";
export function FormatProperties(properties: any) {
const property_bag: Record<Binding, any> = {}
const property_bag: Record<Binding, any> = {};
for (const key in properties) {
const value = properties[key]
for (const key in properties) {
const value = properties[key];
if (key.startsWith("#")) {
property_bag[<Binding>key] = value
delete properties[key]
}
}
if (key.startsWith("#")) {
property_bag[<Binding>key] = value;
delete properties[key];
}
}
if (properties.anchor) {
properties.anchor_from = properties.anchor_to = properties.anchor
delete properties.anchor
}
if (properties.anchor) {
properties.anchor_from = properties.anchor_to = properties.anchor;
delete properties.anchor;
}
if (Object.keys(property_bag).length) {
if (properties.property_bag) {
properties.property_bag = { ...property_bag, ...properties.property_bag }
} else {
properties.property_bag = property_bag
}
}
if (Object.keys(property_bag).length) {
if (properties.property_bag) {
properties.property_bag = { ...property_bag, ...properties.property_bag };
} else {
properties.property_bag = property_bag;
}
}
return properties
return properties;
}
export function FormatAnimationProperties(properties: KeyframeAnimationProperties<AnimType>) {
if (properties.next instanceof AnimationKeyframe) {
properties.next = `${properties.next}`
}
export function FormatAnimationProperties(
properties: KeyframeAnimationProperties<AnimType>,
) {
if (properties.next instanceof AnimationKeyframe) {
properties.next = `${properties.next}`;
}
return properties
return properties;
}