feat: animation system

This commit is contained in:
Asaki Yuki 2026-01-26 13:27:54 +07:00
parent 406e71575f
commit 7534a613cb
22 changed files with 19733 additions and 19122 deletions

View file

@ -1,3 +1,6 @@
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) {
@ -27,3 +30,11 @@ export function FormatProperties(properties: any) {
return properties
}
export function FormatAnimationProperties(properties: KeyframeAnimationProperties<AnimType>) {
if (properties.next instanceof AnimationKeyframe) {
properties.next = `${properties.next}`
}
return properties
}

View file

@ -1,9 +1,11 @@
import { AnimationKeyframe } from "../components/AnimationKeyframe.js"
import { Class } from "../components/Class.js"
import { UI } from "../components/UI.js"
import { AnimType } from "../types/enums/AnimType.js"
import { Renderer } from "../types/enums/Renderer.js"
import { Type } from "../types/enums/Type.js"
type Element = UI<Type, Renderer | null>
type Element = UI<Type, Renderer | null> | AnimationKeyframe<AnimType>
interface FileInterface {
namespace: string
elements: Element[]
@ -13,7 +15,7 @@ type Files = Map<string, FileInterface>
export class Memory extends Class {
protected static files: Files = new Map<string, FileInterface>()
public static add(element: UI<Type, Renderer | null>) {
public static add(element: UI<Type, Renderer | null> | AnimationKeyframe<AnimType>) {
let file = Memory.files.get(element.path)
if (!file) {

View file

@ -1,5 +1,9 @@
import { Memory } from "./Memory.js"
process.on("beforeExit", () => {
// console.log(Memory.build())
})
const isBuildMode = process.argv.includes("--build")
if (isBuildMode) {
process.on("beforeExit", () => {
console.log(JSON.stringify(Memory.build(), null, 2))
})
}