npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mw-utils-ui-anim

v1.3.0

Published

MetaWorld Utils

Downloads

3

Readme

MWUtils-UIAnim

口袋方舟(MetaWorld)工具库

UI 动画工具,提供简单的 UI 进出场、变换动画预实现

使用指南

安装

npm i mw-utils-ui-anim

使用示例

export default class TestUI extends TestUI_Generate {
  protected onAwake() {
    this.canUpdate = false;
    this.layer = UI.UILayerBottom;
    // 按键将进度条缓动到指定位置
    Util.InputUtil.onKeyDown(Type.Keys.Z, () => {
      UIAnimUtil.Common.progressTo(this.mProgressBar, 0, 500);
    });
    Util.InputUtil.onKeyDown(Type.Keys.X, () => {
      UIAnimUtil.Common.progressTo(this.mProgressBar, 90, 500);
    });
  }

  public show() {
    // 显示当前UI并播放进场动画
    UI.UIManager.instance.showUI(this);
    UIAnimUtil.Enter.scale(this.uiObject, UIAnimUtil.Direction.Bottom);
  }

  public hide() {
    // 播放出场动画并在完成时隐藏
    UIAnimUtil.Exit.scale(
      this.uiObject,
      UIAnimUtil.Direction.Bottom,
      1000,
      () => {
        UI.UIManager.instance.hideUI(this);
      }
    );
  }
}

预制动画

通用动画

文本数字缓动

UIAnimUtil.Common.numberContentTo(widget, num, time, onComplete);
/**
 * @param widget 应用动画的Widget
 * @param num 目标数字值
 * @param time 动画持续时间
 * @param onComplete 动画完成后回调
 */

缩放

UIAnimUtil.Common.scaleTo(widget, scale, time, onComplete);
/**
 * @param widget 应用动画的Widget
 * @param scale 目标缩放值
 * @param time 动画持续时间
 * @param onComplete 动画完成后回调
 */

摇晃

UIAnimUtil.Common.wobble(
  widget,
  angle,
  wobbleCount,
  repeat,
  repeatDelay,
  time,
  onComplete
);
/**
 * @param widget 应用动画的Widget
 * @param angle 晃动的偏移角度
 * @param wobbleCount 单次动画晃动次数
 * @param repeat 播放次数
 * @param repeatDelay 再次播放间隔
 * @param time 动画持续时间
 * @param onComplete 动画完成后回调
 */

进度条缓动

UIAnimUtil.Common.progressTo(widget, value, time, onComplete);
/**
 * @param widget 应用动画的Widget
 * @param value 目标值
 * @param time 动画持续时间
 * @param onComplete 动画完成后回调
 */

进场动画

淡入

UIAnimUtil.Enter.fade(widget, time, onComplete);
/**
 * @param widget 应用动画的Widget
 * @param time 动画持续时间
 * @param onComplete 动画完成后回调
 */

平移进场

UIAnimUtil.Enter.move(widget, dir, time, onComplete, easing);
/**
 * @param widget 应用动画的Widget
 * @param dir 方向
 * @param time 动画持续时间
 * @param onComplete 动画完成后回调
 * @param easing 动画运动曲线(默认线性)
 */

缩放进场

UIAnimUtil.Enter.scale(widget, dir, time, onComplete);
/**
 * @param widget 应用动画的Widget
 * @param dir 方向
 * @param time 动画持续时间
 * @param onComplete 动画完成后回调
 */

出场动画

淡出

UIAnimUtil.Exit.fade(widget, time, onComplete);
/**
 * @param widget 应用动画的Widget
 * @param time 动画持续时间
 * @param onComplete 动画完成后回调
 */

平移出场

UIAnimUtil.Exit.move(widget, dir, time, onComplete, easing);
/**
 * @param widget 应用动画的Widget
 * @param dir 方向
 * @param time 动画持续时间
 * @param onComplete 动画完成后回调
 * @param easing 动画运动曲线(默认线性)
 */

缩放出场

UIAnimUtil.Exit.scale(widget, dir, time, onComplete);
/**
 * @param widget 应用动画的Widget
 * @param dir 方向
 * @param time 动画持续时间
 * @param onComplete 动画完成后回调
 */

版本适配

| 库版本 | 适配编辑器版本 | 备注 | | ------ | -------------- | ---- | | 1.2.x | 0.20.x | | | 1.1.x | 0.18.x | |