@x1a0ma17x/zeppos-fx 2.0.3
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/.z18n.config.json +11 -0
- package/License +21 -0
- package/README.md +190 -0
- package/README_zh-CN.md +196 -0
- package/example/app-side/i18n/en-US.po +2 -0
- package/example/app-side/index.js +13 -0
- package/example/app.js +10 -0
- package/example/app.json +52 -0
- package/example/assets/default.b/icon.png +0 -0
- package/example/assets/default.r/icon.png +0 -0
- package/example/assets/default.s/icon.png +0 -0
- package/example/global.d.ts +1 -0
- package/example/jsconfig.json +9 -0
- package/example/package.json +14 -0
- package/example/page/i18n/en-US.po +2 -0
- package/example/page/i18n/fr-FR.po +4 -0
- package/example/page/i18n/ru-RU.po +4 -0
- package/example/page/i18n/zh-CN.po +2 -0
- package/example/page/i18n/zh-TW.po +4 -0
- package/example/page/index.anim.js +37 -0
- package/example/page/index.js +19 -0
- package/example/page/index.r.layout.js +6 -0
- package/example/page/index.style.js +13 -0
- package/example/setting/i18n/en-US.po +2 -0
- package/example/setting/index.js +7 -0
- package/fx.js +623 -0
- package/fx.js.png +0 -0
- package/index.js +1 -0
- package/old/v1.0/fx.js +706 -0
- package/old/v1.0/smoothTimer.js +92 -0
- package/old/v2.0/fx.js +761 -0
- package/old/v2.0/zeppos_timer.js +64 -0
- package/package.json +25 -0
- package/src/example/app.js +10 -0
- package/src/example/app.json +46 -0
- 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 +1 -0
- package/src/example/jsconfig.json +9 -0
- package/src/example/libs/fx.js +325 -0
- package/src/example/package.json +14 -0
- package/src/example/page/anim.js +60 -0
- package/src/example/page/i18n/en-US.po +2 -0
- package/src/example/page/index.js +13 -0
- package/src/example/page/index.r.layout.js +6 -0
package/License
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022-2024 XiaomaiTX
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
<a name="readme-top"></a>
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
[![Contributors][contributors-shield]][contributors-url]
|
|
5
|
+
[![Forks][forks-shield]][forks-url]
|
|
6
|
+
[![Stargazers][stars-shield]][stars-url]
|
|
7
|
+
[![Issues][issues-shield]][issues-url]
|
|
8
|
+
[![MIT License][license-shield]][license-url]
|
|
9
|
+
|
|
10
|
+
<br />
|
|
11
|
+
<div align="center">
|
|
12
|
+
<a href="https://github.com/XiaomaiTX/zeppos-fx">
|
|
13
|
+
<img src="fx.js.png" alt="Logo" width="80" height="80">
|
|
14
|
+
</a>
|
|
15
|
+
|
|
16
|
+
<h3 align="center">fx.js</h3>
|
|
17
|
+
|
|
18
|
+
<p align="center">
|
|
19
|
+
A library for providing simple animations in ZeppOS.
|
|
20
|
+
<br />
|
|
21
|
+
<a href="https://github.com/XiaomaiTX/zeppos-fx/blob/master/README_zh-CN.md"><strong>中文文档(在写了别催了) »</strong></a>
|
|
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>
|
|
29
|
+
</p>
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
<details>
|
|
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:
|
|
61
|
+
|
|
62
|
+
- In ZeppOS 1.0, there is no official animation interface for the control, so developers need to write their own animation libraries to implement animation features.
|
|
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
|
|
65
|
+
|
|
66
|
+
Use the <a href="#usage">Usage</a> to easily get started.
|
|
67
|
+
|
|
68
|
+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
## Getting Started
|
|
72
|
+
|
|
73
|
+
The content here will help you get familiar with the program quickly.
|
|
74
|
+
|
|
75
|
+
### Prerequisites
|
|
76
|
+
|
|
77
|
+
Before using this library, please make sure you already have an understanding of ZeppOS applet development, you can refer to the [ZeppOS official documentation](https://docs.zepp.com/docs/intro/).
|
|
78
|
+
Also, you need a `code editor(Like Microsoft VSCode)` and `knowledge of JavaScript`.
|
|
79
|
+
|
|
80
|
+
### Installation
|
|
81
|
+
|
|
82
|
+
1. To use this library, you need to create a ZeppOS applet project first.refer to the [ZeppOS quick start](https://docs.zepp.com/docs/guides/quick-start/).
|
|
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
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
At this point, you're ready to use the `fx.js` library
|
|
93
|
+
|
|
94
|
+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
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
|
|
100
|
+
|
|
101
|
+
```js
|
|
102
|
+
const text = hmUI.createWidget(hmUI.widget.TEXT, {
|
|
103
|
+
// create a text widget
|
|
104
|
+
x: 100,
|
|
105
|
+
y: 120,
|
|
106
|
+
w: 288,
|
|
107
|
+
h: 46,
|
|
108
|
+
color: 0xffffff,
|
|
109
|
+
text_size: 36,
|
|
110
|
+
align_h: hmUI.align.CENTER_H,
|
|
111
|
+
align_v: hmUI.align.CENTER_V,
|
|
112
|
+
text_style: hmUI.text_style.NONE,
|
|
113
|
+
text: 'HELLO ZEPPOS'
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
let fx = new Fx({
|
|
117
|
+
begin: 100, // Initial value of function.
|
|
118
|
+
end: 200, // Target value of function.
|
|
119
|
+
fps: 60, // FPS.
|
|
120
|
+
time: 1, // Total during time (s).
|
|
121
|
+
style: Fx.Styles.EASE_IN_OUT_QUAD, // Types of animation presets used, seeing @Fx.Style.
|
|
122
|
+
onStop() {
|
|
123
|
+
console.log("anim stop");
|
|
124
|
+
}, // Callback function at the end of the animation.
|
|
125
|
+
|
|
126
|
+
// Callback function for each frame, the parameter is the current function value, the value range is [begin, end]
|
|
127
|
+
func: (result) => text.setProperty(hmUI.prop.X, result),
|
|
128
|
+
});
|
|
129
|
+
fx.restart(); // Replay animation can be called multiple times.
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
## Roadmap
|
|
136
|
+
|
|
137
|
+
- [x] Add basic presets
|
|
138
|
+
- [x] Add function to mix colors
|
|
139
|
+
- [ ] Add more presets
|
|
140
|
+
- [ ] Multi-language Support for README
|
|
141
|
+
- [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
|
+
|
|
148
|
+
|
|
149
|
+
## Contributing
|
|
150
|
+
|
|
151
|
+
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
|
|
152
|
+
|
|
153
|
+
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
|
|
154
|
+
Don't forget to give the project a star! Thanks again!
|
|
155
|
+
|
|
156
|
+
1. Fork the Project
|
|
157
|
+
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
|
|
158
|
+
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
|
|
159
|
+
4. Push to the Branch (`git push origin feature/AmazingFeature`)
|
|
160
|
+
5. Open a Pull Request
|
|
161
|
+
|
|
162
|
+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
## License
|
|
166
|
+
|
|
167
|
+
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
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
<a name="readme-top"></a>
|
|
2
|
+
# 在写了,别急
|
|
3
|
+
|
|
4
|
+
[![Contributors][contributors-shield]][contributors-url]
|
|
5
|
+
[![Forks][forks-shield]][forks-url]
|
|
6
|
+
[![Stargazers][stars-shield]][stars-url]
|
|
7
|
+
[![Issues][issues-shield]][issues-url]
|
|
8
|
+
[![MIT License][license-shield]][license-url]
|
|
9
|
+
|
|
10
|
+
<br />
|
|
11
|
+
<div align="center">
|
|
12
|
+
<a href="https://github.com/XiaomaiTX/zeppos-fx">
|
|
13
|
+
<img src="fx.js.png" alt="Logo" width="80" height="80">
|
|
14
|
+
</a>
|
|
15
|
+
|
|
16
|
+
<h3 align="center">fx.js</h3>
|
|
17
|
+
|
|
18
|
+
<p align="center">
|
|
19
|
+
一个用于在ZeppOS中提供简单动画的库
|
|
20
|
+
<br />
|
|
21
|
+
<a href="https://github.com/XiaomaiTX/zeppos-fx/blob/master/README.md"><strong>English Document »</strong></a>
|
|
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>
|
|
31
|
+
</p>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
<details>
|
|
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>
|
|
70
|
+
|
|
71
|
+
|
|
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
|
+
### 安装
|
|
83
|
+
|
|
84
|
+
1. 使用fx.js之前,你需要准备一个 ZeppOS 小程序项目,如果还没有创建,你可以参考这部分的文档 [ZeppOS quick start](https://docs.zepp.com/docs/guides/quick-start/).
|
|
85
|
+
|
|
86
|
+
2. 请前往 [Releases](https://github.com/XiaomaiTX/zeppos-fx/releases) 下载最新稳定版fx.js,然后把fx.js放到项目根目录的 `utils/` 目录中
|
|
87
|
+
|
|
88
|
+
3. 在项目中添加对fx.js的引用
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
```js
|
|
92
|
+
import { Fx } from "../utils/fx"; // 这里换成fx.js相对于该文件的相对路径
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
至此,你可以尽情享受fx.js带来的动画效果了,什么?不知道怎么用?那就看看Usage吧
|
|
96
|
+
|
|
97
|
+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
## 如何使用
|
|
101
|
+
|
|
102
|
+
可以参考这个简单的示例,如果正常运行,文本控件的x值应该由100变为200,即向右进行非线性移动
|
|
103
|
+
如果有什么问题可以提交issue或联系XiaomaiTX,但是在发问前请确保自己已经经过思考
|
|
104
|
+
当然,你可以先看看我博客的文章[《提问的智慧》](https://blog.uuu4.cn/archives/12/)
|
|
105
|
+
|
|
106
|
+
```js
|
|
107
|
+
const text = hmUI.createWidget(hmUI.widget.TEXT, {
|
|
108
|
+
// 创建一个简单的 TEXT 控件
|
|
109
|
+
x: 100,
|
|
110
|
+
y: 120,
|
|
111
|
+
w: 288,
|
|
112
|
+
h: 46,
|
|
113
|
+
color: 0xffffff,
|
|
114
|
+
text_size: 36,
|
|
115
|
+
align_h: hmUI.align.CENTER_H,
|
|
116
|
+
align_v: hmUI.align.CENTER_V,
|
|
117
|
+
text_style: hmUI.text_style.NONE,
|
|
118
|
+
text: 'HELLO ZEPPOS'
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
let fx = new Fx({
|
|
122
|
+
begin: 100, // 初始函数值
|
|
123
|
+
end: 200, // 目标函数值
|
|
124
|
+
fps: 60, // 帧率
|
|
125
|
+
time: 1, // 总时长(秒)
|
|
126
|
+
style: Fx.Styles.EASE_IN_OUT_QUAD, // 预设类型 见fx.js中的Fx.Style
|
|
127
|
+
|
|
128
|
+
onStop() {
|
|
129
|
+
console.log("anim stop");
|
|
130
|
+
}, // 动画结束后的回调函数
|
|
131
|
+
|
|
132
|
+
// 每一帧的回调函数,参数为当前函数值,取值范围为[begin, end]
|
|
133
|
+
func: (result) => text.setProperty(hmUI.prop.X, result),
|
|
134
|
+
});
|
|
135
|
+
fx.restart(); // 播放动画 可以重复多次调用
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
## Roadmap
|
|
142
|
+
|
|
143
|
+
- [x] 添加一些基本的动画预设
|
|
144
|
+
- [x] 添加颜色混合动画函数
|
|
145
|
+
- [ ] 添加更多的预设(咕咕咕,靠大家的贡献啦~)
|
|
146
|
+
- [ ] 为README编写多语言适配(感觉中英就够了?)
|
|
147
|
+
- [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
|
+
|
|
155
|
+
|
|
156
|
+
## Contributing
|
|
157
|
+
|
|
158
|
+
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
|
|
159
|
+
|
|
160
|
+
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
|
|
161
|
+
Don't forget to give the project a star! Thanks again!
|
|
162
|
+
|
|
163
|
+
1. Fork the Project
|
|
164
|
+
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
|
|
165
|
+
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
|
|
166
|
+
4. Push to the Branch (`git push origin feature/AmazingFeature`)
|
|
167
|
+
5. Open a Pull Request
|
|
168
|
+
|
|
169
|
+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
## License
|
|
173
|
+
|
|
174
|
+
Distributed under the MIT License. See `LICENSE.txt` for more information.
|
|
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
|
package/example/app.js
ADDED
package/example/app.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"configVersion": "v3",
|
|
3
|
+
"app": {
|
|
4
|
+
"appId": 25881,
|
|
5
|
+
"appName": "Empty",
|
|
6
|
+
"appType": "app",
|
|
7
|
+
"version": {
|
|
8
|
+
"code": 1,
|
|
9
|
+
"name": "1.0.0"
|
|
10
|
+
},
|
|
11
|
+
"icon": "icon.png",
|
|
12
|
+
"vender": "zepp",
|
|
13
|
+
"description": "empty application"
|
|
14
|
+
},
|
|
15
|
+
"permissions": [],
|
|
16
|
+
"runtime": {
|
|
17
|
+
"apiVersion": {
|
|
18
|
+
"compatible": "3.0.0",
|
|
19
|
+
"target": "3.0.0",
|
|
20
|
+
"minVersion": "3.0"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"targets": {
|
|
24
|
+
"default": {
|
|
25
|
+
"module": {
|
|
26
|
+
"page": {
|
|
27
|
+
"pages": [
|
|
28
|
+
"page/index"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"app-side": {
|
|
32
|
+
"path": "app-side/index"
|
|
33
|
+
},
|
|
34
|
+
"setting": {
|
|
35
|
+
"path": "setting/index"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"platforms": [
|
|
39
|
+
{
|
|
40
|
+
"st": "r",
|
|
41
|
+
"dw": 480
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"i18n": {
|
|
47
|
+
"en-US": {
|
|
48
|
+
"appName": "Empty"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"defaultLanguage": "en-US"
|
|
52
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference path="node_modules/@zeppos/device-types/dist/index.d.ts" />
|
|
@@ -0,0 +1,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
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Fx } from "../../fx";
|
|
2
|
+
const Track_1 = [
|
|
3
|
+
{
|
|
4
|
+
props: {
|
|
5
|
+
startTime: 1,
|
|
6
|
+
duration: 1,
|
|
7
|
+
fps: 1,
|
|
8
|
+
fx_style: Fx.Styles.LINEAR,
|
|
9
|
+
repeat: true,
|
|
10
|
+
},
|
|
11
|
+
func: (result) => {
|
|
12
|
+
console.log("result1 ", result);
|
|
13
|
+
return;
|
|
14
|
+
},
|
|
15
|
+
onStop: (result) => {
|
|
16
|
+
return;
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
props: {
|
|
21
|
+
startTime: 1,
|
|
22
|
+
duration: 1,
|
|
23
|
+
fps: 1,
|
|
24
|
+
fx_style: Fx.Styles.LINEAR,
|
|
25
|
+
repeat: true,
|
|
26
|
+
},
|
|
27
|
+
func: (result) => {
|
|
28
|
+
console.log("result2 ", result);
|
|
29
|
+
return;
|
|
30
|
+
},
|
|
31
|
+
onStop: (result) => {
|
|
32
|
+
return;
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
export const AnimProfile = [Track_1];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import hmUI from "@zos/ui";
|
|
2
|
+
import { getText } from "@zos/i18n";
|
|
3
|
+
import * as Styles from "zosLoader:./index.[pf].layout.js";
|
|
4
|
+
import { Fx } from "../../fx";
|
|
5
|
+
import { AnimProfile } from "./index.anim";
|
|
6
|
+
import * as STYLE from "./index.style";
|
|
7
|
+
|
|
8
|
+
Page({
|
|
9
|
+
build() {
|
|
10
|
+
console.log(getText("example"));
|
|
11
|
+
const button = hmUI.createWidget(hmUI.widget.BUTTON, STYLE.BUTTON);
|
|
12
|
+
const anim = new Fx(AnimProfile, button);
|
|
13
|
+
anim.start();
|
|
14
|
+
// anim.stop();
|
|
15
|
+
// anim.pause();
|
|
16
|
+
// anim.restart();
|
|
17
|
+
// anim.status();
|
|
18
|
+
},
|
|
19
|
+
});
|