@x1a0ma17x/zeppos-fx 2.0.3 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/settings.json +3 -0
- package/CHANGELOG.md +33 -0
- package/README.md +68 -136
- package/README_zh-CN.md +65 -142
- package/example/app.js +9 -9
- package/example/app.json +4 -10
- package/example/global.d.ts +1 -1
- package/example/jsconfig.json +9 -9
- package/example/package.json +17 -14
- package/example/page/i18n/en-US.po +1 -1
- package/example/page/index.js +45 -19
- package/example/page/index.r.layout.js +6 -6
- package/example/pnpm-lock.yaml +31 -0
- package/fx.js +6 -6
- package/package.json +1 -1
- package/example/app-side/i18n/en-US.po +0 -2
- package/example/app-side/index.js +0 -13
- package/example/page/i18n/fr-FR.po +0 -4
- package/example/page/i18n/ru-RU.po +0 -4
- package/example/page/i18n/zh-CN.po +0 -2
- package/example/page/i18n/zh-TW.po +0 -4
- package/example/page/index.anim.js +0 -37
- package/example/page/index.style.js +0 -13
- package/example/setting/i18n/en-US.po +0 -2
- package/example/setting/index.js +0 -7
- package/src/example/app.js +0 -10
- package/src/example/app.json +0 -46
- package/src/example/assets/default.b/icon.png +0 -0
- package/src/example/assets/default.r/icon.png +0 -0
- package/src/example/assets/default.s/icon.png +0 -0
- package/src/example/global.d.ts +0 -1
- package/src/example/jsconfig.json +0 -9
- package/src/example/libs/fx.js +0 -325
- package/src/example/package.json +0 -14
- package/src/example/page/anim.js +0 -60
- package/src/example/page/i18n/en-US.po +0 -2
- package/src/example/page/index.js +0 -13
- package/src/example/page/index.r.layout.js +0 -6
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [2.0.4] - 2026-01-05
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- Fixed `delay` parameter bug where delay was not being applied correctly in timer.start()
|
|
12
|
+
- Fixed `time` parameter unit inconsistency, changed from seconds to milliseconds
|
|
13
|
+
- Fixed animation calculations to use milliseconds consistently
|
|
14
|
+
|
|
15
|
+
### Breaking Changes
|
|
16
|
+
- **BREAKING CHANGE**: `time` parameter unit from changed seconds to milliseconds
|
|
17
|
+
- Old: `time: 1` (1 second)
|
|
18
|
+
- New: `time: 1000` (1000 milliseconds = 1 second)
|
|
19
|
+
- All existing code must multiply `time` values by 1000
|
|
20
|
+
- `delay` parameter documentation clarified to use milliseconds
|
|
21
|
+
|
|
22
|
+
### Updated
|
|
23
|
+
- Updated README.md and README_zh-CN.md documentation
|
|
24
|
+
- Updated example/page/index.js example code
|
|
25
|
+
- Updated old/v2.0/fx.js for consistency
|
|
26
|
+
|
|
27
|
+
## [2.0.3] - 2025-11-30
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
- Initial release of zeppos-fx animation library
|
|
31
|
+
- Support for multiple easing functions
|
|
32
|
+
- ZeppOS timer integration
|
|
33
|
+
- Comprehensive documentation and examples
|
package/README.md
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
<a name="readme-top"></a>
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
[![Stargazers][stars-shield]][stars-url]
|
|
7
|
-
[![Issues][issues-shield]][issues-url]
|
|
8
|
-
[![MIT License][license-shield]][license-url]
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
9
6
|
|
|
10
7
|
<br />
|
|
11
8
|
<div align="center">
|
|
@@ -13,138 +10,99 @@
|
|
|
13
10
|
<img src="fx.js.png" alt="Logo" width="80" height="80">
|
|
14
11
|
</a>
|
|
15
12
|
|
|
16
|
-
<h3 align="center">
|
|
13
|
+
<h3 align="center">ZeppOS Fx</h3>
|
|
17
14
|
|
|
18
15
|
<p align="center">
|
|
19
16
|
A library for providing simple animations in ZeppOS.
|
|
20
17
|
<br />
|
|
21
|
-
<a href="https://github.com/XiaomaiTX/zeppos-fx/blob/master/README_zh-CN.md"><strong
|
|
22
|
-
<br />
|
|
23
|
-
<br />
|
|
24
|
-
<a href="https://github.com/XiaomaiTX/zeppos-fx/releases">Download</a>
|
|
25
|
-
·
|
|
26
|
-
<a href="https://github.com/XiaomaiTX/zeppos-fx/issues">Report Bug</a>
|
|
27
|
-
·
|
|
28
|
-
<a href="https://github.com/XiaomaiTX/zeppos-fx/issues">Request Feature</a>
|
|
18
|
+
English | <a href="https://github.com/XiaomaiTX/zeppos-fx/blob/master/README_zh-CN.md"><strong>中文文档</strong></a>
|
|
29
19
|
</p>
|
|
30
20
|
</div>
|
|
31
21
|
|
|
32
|
-
|
|
33
|
-
<summary>Table of Contents</summary>
|
|
34
|
-
<ol>
|
|
35
|
-
<li>
|
|
36
|
-
<a href="#about-the-project">About The fx.js</a>
|
|
37
|
-
</li>
|
|
38
|
-
<li>
|
|
39
|
-
<a href="#getting-started">Getting Started</a>
|
|
40
|
-
<ul>
|
|
41
|
-
<li><a href="#prerequisites">Prerequisites</a></li>
|
|
42
|
-
<li><a href="#installation">Installation</a></li>
|
|
43
|
-
</ul>
|
|
44
|
-
</li>
|
|
45
|
-
<li><a href="#usage">Usage</a></li>
|
|
46
|
-
<li><a href="#roadmap">Roadmap</a></li>
|
|
47
|
-
<li><a href="#contributing">Contributing</a></li>
|
|
48
|
-
<li><a href="#license">License</a></li>
|
|
49
|
-
<li><a href="#contact">Contact</a></li>
|
|
50
|
-
</ol>
|
|
51
|
-
</details>
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
## About The Project
|
|
55
|
-
|
|
56
|
-
A library for providing simple animations in ZeppOS.
|
|
57
|
-
You can use simple functions to add animations to your UI widgets
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
Here's why:
|
|
22
|
+
This is a flexible, elegant, and high-performance animation library for ZeppOS.
|
|
61
23
|
|
|
62
|
-
|
|
63
|
-
- In order to save your developers' work at the bottom, we have created an animation library for ZeppOS that helps developers to quickly build UI controls with linear or non-linear animations in ZeppOS applets
|
|
64
|
-
- You can also easily add custom animations to your UI widgets
|
|
24
|
+
You can effortlessly add various elegant animation effects to existing UI controls.
|
|
65
25
|
|
|
66
|
-
|
|
26
|
+
Why choose fx.js:
|
|
67
27
|
|
|
68
|
-
|
|
28
|
+
- ✅ High-performance non-linear animation calculations
|
|
69
29
|
|
|
30
|
+
- ✅ Extensive animation presets
|
|
70
31
|
|
|
71
|
-
|
|
32
|
+
- ✅ Complete state control
|
|
72
33
|
|
|
73
|
-
|
|
34
|
+
- ✅ Simply import ZeppOS Fx to implement
|
|
74
35
|
|
|
75
|
-
|
|
36
|
+
~~In ZeppOS 1.0, the official platform does not provide interfaces for control animations. We believe developers can use this fx library to add engaging animations to ZeppOS 1.0 mini-programs (e.g., developing mini-programs for the Xiaomi Mi Band 7)~~
|
|
76
37
|
|
|
77
|
-
|
|
78
|
-
Also, you need a `code editor(Like Microsoft VSCode)` and `knowledge of JavaScript`.
|
|
38
|
+
## 🚀 Quick Start
|
|
79
39
|
|
|
80
|
-
### Installation
|
|
40
|
+
### 📦 Installation
|
|
81
41
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
2. Please download the latest `fx.js` file in the [Releases](https://github.com/XiaomaiTX/zeppos-fx/releases), and place `fx.js` in the `utils/` directory of the root of the applet
|
|
85
|
-
|
|
86
|
-
3. Add a reference to fx.js in the project
|
|
87
|
-
|
|
88
|
-
```js
|
|
89
|
-
import { Fx } from "../utils/fx"; // Replace with the path to your fx.js
|
|
42
|
+
```bash
|
|
43
|
+
pnpm install @x1a0ma17x/zeppos-fx
|
|
90
44
|
```
|
|
91
45
|
|
|
92
|
-
|
|
46
|
+
## Usage Guide
|
|
93
47
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
## Usage
|
|
97
|
-
|
|
98
|
-
You can refer to the following example to use this library and you should get the expected results like this:
|
|
99
|
-
The position of the text moves from x=100 to x=200 with a non-linear motion effect
|
|
48
|
+
Refer to this simple example: If executed correctly, the text control's x-value should transition from 100 to 200, indicating a nonlinear movement to the right
|
|
100
49
|
|
|
101
50
|
```js
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
51
|
+
import * as hmUI from "@zos/ui";
|
|
52
|
+
import { Fx } from "@x1a0ma17x/zeppos-fx";
|
|
53
|
+
|
|
54
|
+
Page({
|
|
55
|
+
build() {
|
|
56
|
+
const text = hmUI.createWidget(hmUI.widget.TEXT, {
|
|
57
|
+
// Create a simple TEXT Widget
|
|
58
|
+
x: 0,
|
|
59
|
+
y: 120,
|
|
60
|
+
w: 288,
|
|
61
|
+
h: 46,
|
|
62
|
+
color: 0xffffff,
|
|
63
|
+
text_size: 36,
|
|
64
|
+
align_h: hmUI.align.CENTER_H,
|
|
65
|
+
align_v: hmUI.align.CENTER_V,
|
|
66
|
+
text_style: hmUI.text_style.NONE,
|
|
67
|
+
text: "HELLO ZEPPOS",
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const fx = new Fx({
|
|
71
|
+
delay: 0, // Delay before execution (in milliseconds)
|
|
72
|
+
begin: 0, // Initial function value
|
|
73
|
+
end: 1, // Final function value
|
|
74
|
+
fps: 60, // Frame rate (frames per second)
|
|
75
|
+
time: 1000, // Total duration (in milliseconds)
|
|
76
|
+
style: Fx.Styles.EASE_IN_OUT_QUAD, // Preset animation style
|
|
77
|
+
enabled: true, // Whether enabled by default (i.e., animation starts automatically when Fx instance is created)
|
|
78
|
+
onStop() {
|
|
79
|
+
// Callback function after animation ends
|
|
80
|
+
console.log("anim stop");
|
|
81
|
+
},
|
|
82
|
+
func: (result) => {
|
|
83
|
+
// Callback function for each frame, with the current function value (range: [begin, end])
|
|
84
|
+
text.setProperty(hmUI.prop.X, 300 * result);
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// State control
|
|
89
|
+
fx.start();
|
|
90
|
+
// fx.pause();
|
|
91
|
+
// fx.stop();
|
|
92
|
+
},
|
|
128
93
|
});
|
|
129
|
-
fx.restart(); // Replay animation can be called multiple times.
|
|
130
94
|
```
|
|
131
95
|
|
|
132
|
-
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
133
|
-
|
|
134
|
-
|
|
135
96
|
## Roadmap
|
|
136
97
|
|
|
137
|
-
- [
|
|
138
|
-
- [x] Add
|
|
139
|
-
- [
|
|
140
|
-
- [
|
|
98
|
+
- [ ] Dynamic compatibility with ZeppOS API
|
|
99
|
+
- [x] Add state management
|
|
100
|
+
- [x] Add basic animation presets
|
|
101
|
+
- [x] Add color blending animation functions
|
|
102
|
+
- [x] Increase preset options
|
|
103
|
+
- [x] Implement multilingual support for README
|
|
141
104
|
- [x] English
|
|
142
|
-
- [
|
|
143
|
-
|
|
144
|
-
See the [open issues](https://github.com/XiaomaiTX/zeppos-fx/issues) for a full list of proposed features (and known issues).
|
|
145
|
-
|
|
146
|
-
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
147
|
-
|
|
105
|
+
- [x] Chinese
|
|
148
106
|
|
|
149
107
|
## Contributing
|
|
150
108
|
|
|
@@ -159,32 +117,6 @@ Don't forget to give the project a star! Thanks again!
|
|
|
159
117
|
4. Push to the Branch (`git push origin feature/AmazingFeature`)
|
|
160
118
|
5. Open a Pull Request
|
|
161
119
|
|
|
162
|
-
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
163
|
-
|
|
164
|
-
|
|
165
120
|
## License
|
|
166
121
|
|
|
167
122
|
Distributed under the MIT License. See `LICENSE.txt` for more information.
|
|
168
|
-
|
|
169
|
-
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
## Contact
|
|
173
|
-
|
|
174
|
-
XiaomaiTX - i@lenrome.cn
|
|
175
|
-
|
|
176
|
-
Project Link: [https://github.com/your_username/repo_name](https://github.com/your_username/repo_name)
|
|
177
|
-
|
|
178
|
-
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
[contributors-shield]: https://img.shields.io/github/contributors/XiaomaiTX/zeppos-fx.svg?style=for-the-badge
|
|
182
|
-
[contributors-url]: https://github.com/XiaomaiTX/zeppos-fx/graphs/contributors
|
|
183
|
-
[forks-shield]: https://img.shields.io/github/forks/XiaomaiTX/zeppos-fx.svg?style=for-the-badge
|
|
184
|
-
[forks-url]: https://github.com/XiaomaiTX/zeppos-fx/network/members
|
|
185
|
-
[stars-shield]: https://img.shields.io/github/stars/XiaomaiTX/zeppos-fx.svg?style=for-the-badge
|
|
186
|
-
[stars-url]: https://github.com/XiaomaiTX/zeppos-fx/stargazers
|
|
187
|
-
[issues-shield]: https://img.shields.io/github/issues/XiaomaiTX/zeppos-fx.svg?style=for-the-badge
|
|
188
|
-
[issues-url]: https://github.com/XiaomaiTX/zeppos-fx/issues
|
|
189
|
-
[license-shield]: https://img.shields.io/github/license/XiaomaiTX/zeppos-fx.svg?style=for-the-badge
|
|
190
|
-
[license-url]: https://github.com/XiaomaiTX/zeppos-fx/blob/master/LICENSE.txt
|
package/README_zh-CN.md
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
<a name="readme-top"></a>
|
|
2
|
-
# 在写了,别急
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
[![Issues][issues-shield]][issues-url]
|
|
8
|
-
[![MIT License][license-shield]][license-url]
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
9
6
|
|
|
10
7
|
<br />
|
|
11
8
|
<div align="center">
|
|
@@ -13,145 +10,96 @@
|
|
|
13
10
|
<img src="fx.js.png" alt="Logo" width="80" height="80">
|
|
14
11
|
</a>
|
|
15
12
|
|
|
16
|
-
<h3 align="center">
|
|
13
|
+
<h3 align="center">ZeppOS Fx</h3>
|
|
17
14
|
|
|
18
15
|
<p align="center">
|
|
19
16
|
一个用于在ZeppOS中提供简单动画的库
|
|
20
17
|
<br />
|
|
21
|
-
<a href="https://github.com/XiaomaiTX/zeppos-fx/blob/master/README.md"><strong>English
|
|
22
|
-
<br />
|
|
23
|
-
<p>我在写文档的时候优先用的英语哦~建议优先读完英文版 当然,中文版更方便大部分大陆开发者使用习惯
|
|
24
|
-
<br />
|
|
25
|
-
<br />
|
|
26
|
-
<a href="https://github.com/XiaomaiTX/zeppos-fx/releases">下载稳定版</a>
|
|
27
|
-
·
|
|
28
|
-
<a href="https://github.com/XiaomaiTX/zeppos-fx/issues">反馈Bug</a>
|
|
29
|
-
·
|
|
30
|
-
<a href="https://github.com/XiaomaiTX/zeppos-fx/issues">提交新建议</a>
|
|
18
|
+
<a href="https://github.com/XiaomaiTX/zeppos-fx/blob/master/README.md"><strong>English</strong></a> | 中文文档
|
|
31
19
|
</p>
|
|
32
20
|
</div>
|
|
33
21
|
|
|
34
|
-
|
|
35
|
-
<summary>目录</summary>
|
|
36
|
-
<ol>
|
|
37
|
-
<li>
|
|
38
|
-
<a href="#about-the-project">关于 fx.js</a>
|
|
39
|
-
</li>
|
|
40
|
-
<li>
|
|
41
|
-
<a href="#getting-started">快速开始</a>
|
|
42
|
-
<ul>
|
|
43
|
-
<li><a href="#prerequisites">前期准备</a></li>
|
|
44
|
-
<li><a href="#installation">安装</a></li>
|
|
45
|
-
</ul>
|
|
46
|
-
</li>
|
|
47
|
-
<li><a href="#usage">如何使用</a></li>
|
|
48
|
-
<li><a href="#roadmap">TODO</a></li>
|
|
49
|
-
<li><a href="#contributing">Contributing</a></li>
|
|
50
|
-
<li><a href="#license">开源协议</a></li>
|
|
51
|
-
<li><a href="#contact">联系我们</a></li>
|
|
52
|
-
</ol>
|
|
53
|
-
</details>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
## 关于 fx.js
|
|
57
|
-
|
|
58
|
-
这是一个一个用于在ZeppOS中提供简单动画的库
|
|
59
|
-
你可以用非常简单的方式来为现有的UI控件添加各种动画效果
|
|
60
|
-
|
|
61
|
-
为什么选择fx.js呢:
|
|
62
|
-
|
|
63
|
-
- 在 ZeppOS 1.0中,官方并没有提供控件动画效果的接口,我们认为开发者可以通过这个fx库来为 ZeppOS 1.0 小程序添加有意思的动画(比如给小米手环7写小程序)
|
|
64
|
-
- 为了方便开发者快速接入现有项目,开发者可以极为方便的使用fx.js来添加线性或非线性动画,而这一切只需要引入fx.js这个库即可
|
|
65
|
-
- 当然,也欢迎各位开发者们添加更多有意思的动画效果
|
|
66
|
-
|
|
67
|
-
快速开始?看看下面的 <a href="#usage">Usage</a> 吧
|
|
68
|
-
|
|
69
|
-
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
22
|
+
这是一个灵活的、优雅、高性能的适用于 ZeppOS 的动画库
|
|
70
23
|
|
|
24
|
+
你可以用非常简单的方式来为现有的UI控件添加各种优雅的动画效果
|
|
71
25
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
以下内容可以让开发者们快速上手
|
|
75
|
-
|
|
76
|
-
### 前期准备
|
|
77
|
-
|
|
78
|
-
在接入fx.js库之前,请确保你已经对 ZeppOS 小程序开发有了一定了解,当然,你也可以从头开始,从 [ZeppOS 官方文档](https://docs.zepp.com/docs/intro/)入手,相信你一定可以快速掌握的
|
|
79
|
-
Also, you need a `code editor(Like Microsoft VSCode)` and `knowledge of JavaScript`.
|
|
80
|
-
emmm,你还需要一个代码编辑器(比如微软的VSCode),以及有关JavaScript的知识
|
|
81
|
-
|
|
82
|
-
### 安装
|
|
26
|
+
为什么选择fx.js呢:
|
|
83
27
|
|
|
84
|
-
|
|
28
|
+
- ✅ 高性能的非线性动画计算
|
|
29
|
+
- ✅ 丰富的动画预设
|
|
30
|
+
- ✅ 完整的状态控制
|
|
31
|
+
- ✅ 一切只需要引入ZeppOS Fx即可
|
|
85
32
|
|
|
86
|
-
|
|
33
|
+
~~在 ZeppOS 1.0中,官方并没有提供控件动画效果的接口,我们认为开发者可以通过这个fx库来为 ZeppOS 1.0 小程序添加有意思的动画(比如给小米手环7写小程序)~~
|
|
87
34
|
|
|
88
|
-
|
|
35
|
+
## 🚀 快速开始
|
|
89
36
|
|
|
37
|
+
### 📦 安装
|
|
90
38
|
|
|
91
|
-
```
|
|
92
|
-
|
|
39
|
+
```bash
|
|
40
|
+
pnpm install @x1a0ma17x/zeppos-fx
|
|
93
41
|
```
|
|
94
42
|
|
|
95
|
-
至此,你可以尽情享受fx.js带来的动画效果了,什么?不知道怎么用?那就看看Usage吧
|
|
96
|
-
|
|
97
|
-
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
98
|
-
|
|
99
|
-
|
|
100
43
|
## 如何使用
|
|
101
44
|
|
|
102
45
|
可以参考这个简单的示例,如果正常运行,文本控件的x值应该由100变为200,即向右进行非线性移动
|
|
103
|
-
如果有什么问题可以提交issue或联系XiaomaiTX,但是在发问前请确保自己已经经过思考
|
|
104
|
-
当然,你可以先看看我博客的文章[《提问的智慧》](https://blog.uuu4.cn/archives/12/)
|
|
105
46
|
|
|
106
47
|
```js
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
48
|
+
import * as hmUI from "@zos/ui";
|
|
49
|
+
import { Fx } from "@x1a0ma17x/zeppos-fx";
|
|
50
|
+
|
|
51
|
+
Page({
|
|
52
|
+
build() {
|
|
53
|
+
const text = hmUI.createWidget(hmUI.widget.TEXT, {
|
|
54
|
+
// 创建一个简单的 TEXT 控件
|
|
55
|
+
x: 0,
|
|
56
|
+
y: 120,
|
|
57
|
+
w: 288,
|
|
58
|
+
h: 46,
|
|
59
|
+
color: 0xffffff,
|
|
60
|
+
text_size: 36,
|
|
61
|
+
align_h: hmUI.align.CENTER_H,
|
|
62
|
+
align_v: hmUI.align.CENTER_V,
|
|
63
|
+
text_style: hmUI.text_style.NONE,
|
|
64
|
+
text: "HELLO ZEPPOS",
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const fx = new Fx({
|
|
68
|
+
delay: 0, // 延迟执行的时间(毫秒)
|
|
69
|
+
begin: 0, // 初始函数值
|
|
70
|
+
end: 1, // 结束函数值
|
|
71
|
+
fps: 60, // 帧率
|
|
72
|
+
time: 1000, // 总时长(毫秒)
|
|
73
|
+
style: Fx.Styles.EASE_IN_OUT_QUAD, // 预设类型
|
|
74
|
+
enabled: true, // 是否默认启用(即创建Fx实例时自动启动)
|
|
75
|
+
onStop() {
|
|
76
|
+
// 动画结束后的回调函数
|
|
77
|
+
console.log("anim stop");
|
|
78
|
+
},
|
|
79
|
+
func: (result) => {
|
|
80
|
+
// 每一帧的回调函数,参数为当前函数值,取值范围为[begin, end]
|
|
81
|
+
text.setProperty(hmUI.prop.X, 300 * result);
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// 状态控制
|
|
86
|
+
fx.start();
|
|
87
|
+
// fx.pause();
|
|
88
|
+
// fx.stop();
|
|
89
|
+
},
|
|
134
90
|
});
|
|
135
|
-
fx.restart(); // 播放动画 可以重复多次调用
|
|
136
91
|
```
|
|
137
92
|
|
|
138
|
-
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
139
|
-
|
|
140
|
-
|
|
141
93
|
## Roadmap
|
|
142
94
|
|
|
95
|
+
- [ ] 动态兼容 ZeppOS API
|
|
96
|
+
- [x] 添加状态管理
|
|
143
97
|
- [x] 添加一些基本的动画预设
|
|
144
98
|
- [x] 添加颜色混合动画函数
|
|
145
|
-
- [
|
|
146
|
-
- [
|
|
99
|
+
- [x] 添加更多的预设
|
|
100
|
+
- [x] 为README编写多语言适配
|
|
147
101
|
- [x] English
|
|
148
|
-
- [
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
See the [open issues](https://github.com/XiaomaiTX/zeppos-fx/issues) for a full list of proposed features (and known issues).
|
|
152
|
-
|
|
153
|
-
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
154
|
-
|
|
102
|
+
- [x] 中文
|
|
155
103
|
|
|
156
104
|
## Contributing
|
|
157
105
|
|
|
@@ -166,31 +114,6 @@ Don't forget to give the project a star! Thanks again!
|
|
|
166
114
|
4. Push to the Branch (`git push origin feature/AmazingFeature`)
|
|
167
115
|
5. Open a Pull Request
|
|
168
116
|
|
|
169
|
-
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
170
|
-
|
|
171
|
-
|
|
172
117
|
## License
|
|
173
118
|
|
|
174
|
-
Distributed under the MIT License. See `LICENSE
|
|
175
|
-
|
|
176
|
-
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
## Contact
|
|
180
|
-
|
|
181
|
-
XiaomaiTX - i@lenrome.cn
|
|
182
|
-
|
|
183
|
-
Project Link: [https://github.com/XiaomaiTX/zeppos-fx](https://github.com/XiaomaiTX/zeppos-fx)
|
|
184
|
-
|
|
185
|
-
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
186
|
-
|
|
187
|
-
[contributors-shield]: https://img.shields.io/github/contributors/XiaomaiTX/zeppos-fx.svg?style=for-the-badge
|
|
188
|
-
[contributors-url]: https://github.com/XiaomaiTX/zeppos-fx/graphs/contributors
|
|
189
|
-
[forks-shield]: https://img.shields.io/github/forks/XiaomaiTX/zeppos-fx.svg?style=for-the-badge
|
|
190
|
-
[forks-url]: https://github.com/XiaomaiTX/zeppos-fx/network/members
|
|
191
|
-
[stars-shield]: https://img.shields.io/github/stars/XiaomaiTX/zeppos-fx.svg?style=for-the-badge
|
|
192
|
-
[stars-url]: https://github.com/XiaomaiTX/zeppos-fx/stargazers
|
|
193
|
-
[issues-shield]: https://img.shields.io/github/issues/XiaomaiTX/zeppos-fx.svg?style=for-the-badge
|
|
194
|
-
[issues-url]: https://github.com/XiaomaiTX/zeppos-fx/issues
|
|
195
|
-
[license-shield]: https://img.shields.io/github/license/XiaomaiTX/zeppos-fx.svg?style=for-the-badge
|
|
196
|
-
[license-url]: https://github.com/XiaomaiTX/zeppos-fx/blob/master/LICENSE.txt
|
|
119
|
+
Distributed under the MIT License. See `LICENSE` for more information.
|
package/example/app.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
App({
|
|
2
|
-
globalData: {},
|
|
3
|
-
onCreate(options) {
|
|
4
|
-
console.log('app on create invoke')
|
|
5
|
-
},
|
|
6
|
-
|
|
7
|
-
onDestroy(options) {
|
|
8
|
-
console.log('app on destroy invoke')
|
|
9
|
-
}
|
|
1
|
+
App({
|
|
2
|
+
globalData: {},
|
|
3
|
+
onCreate(options) {
|
|
4
|
+
console.log('app on create invoke')
|
|
5
|
+
},
|
|
6
|
+
|
|
7
|
+
onDestroy(options) {
|
|
8
|
+
console.log('app on destroy invoke')
|
|
9
|
+
}
|
|
10
10
|
})
|
package/example/app.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"configVersion": "v3",
|
|
3
3
|
"app": {
|
|
4
|
-
"appId":
|
|
4
|
+
"appId": 28682,
|
|
5
5
|
"appName": "Empty",
|
|
6
6
|
"appType": "app",
|
|
7
7
|
"version": {
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"permissions": [],
|
|
16
16
|
"runtime": {
|
|
17
17
|
"apiVersion": {
|
|
18
|
-
"compatible": "
|
|
19
|
-
"target": "
|
|
20
|
-
"minVersion": "
|
|
18
|
+
"compatible": "4.0",
|
|
19
|
+
"target": "4.0",
|
|
20
|
+
"minVersion": "4.0"
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"targets": {
|
|
@@ -27,12 +27,6 @@
|
|
|
27
27
|
"pages": [
|
|
28
28
|
"page/index"
|
|
29
29
|
]
|
|
30
|
-
},
|
|
31
|
-
"app-side": {
|
|
32
|
-
"path": "app-side/index"
|
|
33
|
-
},
|
|
34
|
-
"setting": {
|
|
35
|
-
"path": "setting/index"
|
|
36
30
|
}
|
|
37
31
|
},
|
|
38
32
|
"platforms": [
|
package/example/global.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
/// <reference path="node_modules/@zeppos/device-types/dist/index.d.ts" />
|
|
1
|
+
/// <reference path="node_modules/@zeppos/device-types/dist/index.d.ts" />
|
package/example/jsconfig.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"module": "commonjs",
|
|
4
|
-
"target": "es6",
|
|
5
|
-
"checkJs": true
|
|
6
|
-
},
|
|
7
|
-
"exclude": ["node_modules", "**/node_modules/*"],
|
|
8
|
-
"files": ["node_modules/@zeppos/device-types/dist/index.d.ts"]
|
|
9
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"target": "es6",
|
|
5
|
+
"checkJs": true
|
|
6
|
+
},
|
|
7
|
+
"exclude": ["node_modules", "**/node_modules/*"],
|
|
8
|
+
"files": ["node_modules/@zeppos/device-types/dist/index.d.ts"]
|
|
9
|
+
}
|
package/example/package.json
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "empty",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "app.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
-
},
|
|
9
|
-
"author": "",
|
|
10
|
-
"license": "ISC",
|
|
11
|
-
"devDependencies": {
|
|
12
|
-
"@zeppos/device-types": "^3.0.0"
|
|
13
|
-
}
|
|
14
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "empty",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "app.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"author": "",
|
|
10
|
+
"license": "ISC",
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"@zeppos/device-types": "^3.0.0"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@x1a0ma17x/zeppos-fx": "^2.0.3"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
msgid "example"
|
|
1
|
+
msgid "example"
|
|
2
2
|
msgstr "This is an example in device"
|