当前位置:网站首页>Dayu200 experience officer homepage AITO video & Canvas drawing dashboard (ETS)
Dayu200 experience officer homepage AITO video & Canvas drawing dashboard (ETS)
2022-07-06 22:51:00 【51CTO】
Catalog
0. explain
OH System version :OpenHarmony3.1Release
IDE: 3.0.0.900
Implement language :ets
- APP Open screen videos are quite common ,dayu200 Support video playback ,3.5 The headphone port also outputs audio normally .
- Dial is very common in modern cars , There are many styles , Different style ,OHOS API8 It also supports rich 2D Drawing ability , It is relatively easy to draw the dial . The above two are to prepare for the smart cockpit . The combination of the two is shown below :

1. Homepage video playback
1.1 Video Component summary
Reference address : be based on TS Of Video Component description
Video The development process is as follows :
- Create a video control object :
- Get the video path :@State srcs: Resource = $rawfile(‘video1’); Network video can also , Need configuration INTERNET jurisdiction . It is worth noting that , You can also visit through Data Ability Video path provided , That is to say, distributed video can also be realized .
- Set up Video attribute :muted( Is it mute? )、autoPlay( Auto play )、controls( Control bar )、objectFit( display mode )、loop( Loop or not ). among ,objectFit The parameter setting value is ImageFit.Cover Then spread the whole container .
- Video event :

It needs to be noted that , utilize onFinish() event , It can realize that after playing the video, we can jump directly to APP Inside .
1.2 Open screen video implementation
Create a new one based on ETS Language project , stay index.ets in , First create a video control object , And video path .
stay Component Medium build Create Video Components , Use Column The container holds ,
Then run the video control when creating the page start Method
2. Canvas Draw dashboard
2.1 Interface Analysis
Reference address : Canvas components There are many ways to draw images , Here we mainly summarize the commonly used and used in instrument drawing .
- establish CanvasRenderingContext2D object
- event :
onReady(callback: () => void) Event callback of canvas component , You can draw at this time . - attribute :
- Provide drawing methods
- How to make the graph move
You can get the system time , Or use setTime To dynamically refresh the image . It seems that the figure is moving, but in fact, some structures are rotating 、 Move or zoom
- gauge Components
Speaking of drawing instrument dial ,gauge Components are also commonly used . and Text Like components ,gauge Highly defined , We can only define parameters simply .gauge Is used as follows :
The effect is as follows :
2.2 Draw a dial
First create 2D Draw objects , And the variables used
Then draw the disc and numbers :
Draw pointer , The pointer needs to rotate a certain angle , So the coordinates must be fixed in the center of the disc
The effect of the dial is as follows :

Use the timer to change the pointer rotation angle and shadow color effect , Combined with the homepage video , Get the sample shown in front of the post .
Want to know more about open source , Please visit :
边栏推荐
- The difference between enumeration and define macro
- 【全网首发】Redis系列3:高可用之主从架构的
- Typescript get function parameter type
- BasicVSR_ Plusplus master test videos and pictures
- OpenSSL:适用TLS与SSL协议的全功能工具包,通用加密库
- 剑指offer刷题记录1
- Sword finger offer question brushing record 1
- Gd32f4xx serial port receive interrupt and idle interrupt configuration
- [step on pit collection] attempting to deserialize object on CUDA device+buff/cache occupy too much +pad_ sequence
- memcached
猜你喜欢

Bipartite graph determination

关于声子和热输运计算中BORN电荷和non-analytic修正的问题

Aardio - Method of batch processing attributes and callback functions when encapsulating Libraries

Enterprises do not want to replace the old system that has been used for ten years

Unified Focal loss: Generalising Dice and cross entropy-based losses to handle class imbalanced medi

Aardio - integrate variable values into a string of text through variable names

MySQL authentication bypass vulnerability (cve-2012-2122)
![[leetcode] 19. Delete the penultimate node of the linked list](/img/ab/25cb6d6538ad02d78f7d64b2a2df3f.png)
[leetcode] 19. Delete the penultimate node of the linked list

金融人士必读书籍系列之六:权益投资(基于cfa考试内容大纲和框架)

On the problems of born charge and non analytical correction in phonon and heat transport calculations
随机推荐
Sizeof keyword
OpenSSL:适用TLS与SSL协议的全功能工具包,通用加密库
【全网首发】Redis系列3:高可用之主从架构的
The statement that allows full table scanning does not seem to take effect set odps sql. allow. fullscan=true; I
config:invalid signature 解决办法和问题排查详解
hdu 5077 NAND(暴力打表)
云原生技术--- 容器知识点
Clip +json parsing converts the sound in the video into text
视图(view)
2014 Alibaba web pre intern project analysis (1)
Advantages of link local address in IPv6
室内LED显示屏应该怎么选择?这5点注意事项必须考虑在内
Aardio - integrate variable values into a string of text through variable names
[step on pit collection] attempting to deserialize object on CUDA device+buff/cache occupy too much +pad_ sequence
面试题:AOF重写机制,redis面试必问!!!
UE4蓝图学习篇(四)--流程控制ForLoop和WhileLoop
BasicVSR_ Plusplus master test videos and pictures
Balanced Multimodal Learning via On-the-fly Gradient Modulation(CVPR2022 oral)
ACL 2022 | 序列标注的小样本NER:融合标签语义的双塔BERT模型
C three ways to realize socket data reception