nickdima / lottie-schema

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lottie schema

基于 vscode 的 json schema https://nickdima.github.io/lottie-schema/animation.json

对 lottie json 进行解析

schema 关系 大图:https://www.processon.com/view/link/5c2ece6ae4b08a768398b06d

how to run

npm install
# 打包
npm run build
# 发布 json schema
npm run deploy

how to use

// 初始化
const lottieSchema = new LottieSchema()
// 添加背景图片
lottieSchema.addBgImage({
  url: 'https://gw.alipayobjects.com/zos/antfincdn/I9Bu85KAaq/750x300.png',
  width: 750,
  height: 300,
})
// 获取lottie json
const animationData = lottieSchema.getObj()
export default class LottieSchema {
    private lottieJSON;
    constructor(options?: any);
    getJSON(): string;
    getObj(): any;
    getVersion(): any;
    getSize(): {
        ip: any;
        op: any;
        width: any;
        height: any;
    };
    setSize({ width, height, }: {
        width: string;
        height: string;
    }): void;
    addBgImage({ url, width, height, }: {
        url: string;
        width: number;
        height: number;
    }): void;
    checkBgImageExist(): false | {
        bgAssetIdx: any;
        bgLayerIdx: any;
    };
    changeBgImage({ size, position, }: {
        size: any | undefined;
        position: any | undefined;
    }): void;
}

About

License:MIT License


Languages

Language:JavaScript 81.8%Language:TypeScript 16.3%Language:HTML 1.9%