当前位置:网站首页>Huawei Hongmeng watch achieves fireworks display effect on New Year's Eve
Huawei Hongmeng watch achieves fireworks display effect on New Year's Eve
2022-07-02 21:02:00 【Li Yuanjing】
Catalogue of fireworks display effects on New Year's Eve
Preface
After more than a year of popularization and Application , Hongmeng system has already involved various terminal equipment of Huawei , Like mobile phone. 、 Loudspeaker box 、 Watch and so on . The blogger just got Huawei WATCH GT Runner, Then use it to write the knowledge of Hongmeng watch development .

image-animator Components
Because it is the first blog post to explain , In order to let everyone know about Hongmeng watch App More interested in development , We will not explain any components separately . here , On New Year's Eve, Huawei watch dial displays fireworks , To make everyone more interested in development .
First , Fireworks bloom on the dial of the watch , It must be a dynamic process , It can be used video Component to implement , It can also be done through gif To achieve .
But it's a pity. , Hongmeng watch development component , Huawei did not provide video Components . Because no one can watch videos with a watch , Then you can only rotate pictures frame by frame , To achieve dynamic fireworks blooming effect .
and JS In the component , Huawei Hongmeng provides a image-animator. seeing the name of a thing one thinks of its function , Picture frame animation player , Through it, we can realize the rotation playback of pictures at a specified interval of seconds .
Realize the fireworks bloom on the dial
because , Since it is GIF Decomposed frame by frame pictures , Then it must be stored in the resource folder of the project , That is to say entry-src-mian-js-default-common In the folder , As shown in the figure below :

next , We need to be in js An array referencing this image is defined in the code :m_images, The specific code is as follows (index.js):
export default {
data: {
m_images:[ {
src: "/common/8.png"}, {
src: "/common/9.png"}
, {
src: "/common/10.png"}, {
src: "/common/11.png"}, {
src: "/common/12.png"}
, {
src: "/common/13.png"}, {
src: "/common/14.png"}, {
src: "/common/15.png"}
, {
src: "/common/16.png"}, {
src: "/common/17.png"}, {
src: "/common/18.png"}
, {
src: "/common/19.png"}, {
src: "/common/20.png"}, {
src: "/common/21.png"}
, {
src: "/common/22.png"}, {
src: "/common/23.png"}, {
src: "/common/24.png"}]
}
}
Because Huawei WATCH GT Runner The dial of is 466*466 Resolution screen , We can directly set the width of all pictures of fireworks to 466, This just shows up on the screen . Of course , It can also be defined directly css Style file settings are also ok .
however , Too many pictures, the bigger the packaged application , It cannot be installed beyond a certain size .index.css The code is as follows :
.container {
width: 100%;
height: 100%;
justify-content: center;
align-items: center;
}
.title {
width: 200px;
font-size: 30px;
text-align: center;
}
.image-mode {
width: 466px;
height: 466px;
}
here , Bloggers directly set the width and height of the image to 466px. After the style definition and the reference array of the image resource file are set , You can directly design the layout file of the dial ,index.hml The code is as follows :
<div class="container">
<image-animator images="{
{m_images}}" duration="3s" class="image-mode"></image-animator>
</div>
among ,duration Property indicates the duration of a single playback , this 3s Divide by the number of pictures , Is the interval time of each frame .
In this way, the fireworks effect can be fully realized , The final effect is exactly the same as that in the first picture .
The project code download address of this blog : Click to download
边栏推荐
- Who do you want to open a stock account? Is it safe to open a mobile account?
- Web3js method to obtain account information and balance
- How can testers do without missing tests? Seven o'clock is enough
- Review of the latest 2022 research on "deep learning methods for industrial defect detection"
- Number of DP schemes
- After eight years of test experience and interview with 28K company, hematemesis sorted out high-frequency interview questions and answers
- Burp install license key not recognized
- 【871. 最低加油次数】
- [internship] solve the problem of too long request parameters
- [cloud native topic -49]:kubesphere cloud Governance - operation - step by step deployment of microservice based business applications - basic processes and steps
猜你喜欢

Jetson XAVIER NX上ResUnet-TensorRT8.2速度与显存记录表(后续不断补充)

JDBC | Chapter 4: transaction commit and rollback

5 environment construction spark on yarn

B-end e-commerce - reverse order process
![[error record] the command line creates an error pub get failed (server unavailable) -- attempting retry 1 in 1 second](/img/6e/c82ff02a249b5d275a4589120a197a.jpg)
[error record] the command line creates an error pub get failed (server unavailable) -- attempting retry 1 in 1 second

Roommate, a king of time, I took care of the C language structure memory alignment

Codeforces round 651 (Div. 2) (a thinking, B thinking, C game, D dichotomy, e thinking)

GCC: Graph Contrastive Coding for Graph Neural NetworkPre-Training

【871. 最低加油次数】
![[cloud native topic -50]:kubesphere cloud Governance - operation - step by step deployment of microservice based business applications - database middleware MySQL microservice deployment process](/img/e6/1dc747de045166f09ecdce1c5a34b1.jpg)
[cloud native topic -50]:kubesphere cloud Governance - operation - step by step deployment of microservice based business applications - database middleware MySQL microservice deployment process
随机推荐
Internal/validators js:124 throw new ERR_ INVALID_ ARG_ Type (name, 'string', value) -- solution
A river of spring water flows eastward
Research Report on the overall scale, major manufacturers, major regions, products and application segmentation of power management units in the global market in 2022
Roommate, a king of time, I took care of the C language structure memory alignment
【Kubernetes系列】kubeadm reset初始化前后空间、内存使用情况对比
[real case] trap of program design - beware of large data
Database schema notes - how to choose the right database in development + who invented relational database?
Common authority query instructions in Oracle
JDBC | Chapter 4: transaction commit and rollback
pytorch 模型保存的完整例子+pytorch 模型保存只保存可訓練參數嗎?是(+解决方案)
How to do interface testing? After reading this article, it will be clear
Research Report on the overall scale, major manufacturers, major regions, products and applications of micro hydraulic cylinders in the global market in 2022
什么叫在线开户?现在网上开户安全么?
After 65 days of closure and control of the epidemic, my home office experience sharing | community essay solicitation
Happy Lantern Festival! Tengyuanhu made you a bowl of hot dumplings!
想请教一下,我在东莞,到哪里开户比较好?手机开户是安全么?
现在券商的优惠开户政策什么?实际上网上开户安全么?
Research Report on the overall scale, major manufacturers, major regions, products and application segmentation of voltage source converters in the global market in 2022
What are the preferential account opening policies of securities companies now? Is it actually safe to open an account online?
Spark source code compilation, cluster deployment and SBT development environment integration in idea