当前位置:网站首页>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 :
边栏推荐
- C# 三种方式实现Socket数据接收
- #DAYU200体验官# 首页aito视频&Canvas绘制仪表盘(ets)
- 面试题:AOF重写机制,redis面试必问!!!
- cuda 探索
- Windows Auzre 微软的云计算产品的后台操作界面
- TypeScript获取函数参数类型
- ICLR 2022 | pre training language model based on anti self attention mechanism
- How to confirm the storage mode of the current system by program?
- UE4蓝图学习篇(四)--流程控制ForLoop和WhileLoop
- DR-Net: dual-rotation network with feature map enhancement for medical image segmentation
猜你喜欢

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

Advantages of link local address in IPv6

剑指offer刷题记录1

Thinkphp5 multi table associative query method join queries two database tables, and the query results are spliced and returned

企业不想换掉用了十年的老系统

ACL 2022 | 序列标注的小样本NER:融合标签语义的双塔BERT模型

DR-Net: dual-rotation network with feature map enhancement for medical image segmentation

European Bioinformatics Institute 2021 highlights report released: nearly 1million proteins have been predicted by alphafold

UE4 blueprint learning chapter (IV) -- process control forloop and whileloop
![pytorch_ Yolox pruning [with code]](/img/98/31d6258635ce48ac53819d0ca12d1d.jpg)
pytorch_ Yolox pruning [with code]
随机推荐
Motion capture for snake motion analysis and snake robot development
Unified Focal loss: Generalising Dice and cross entropy-based losses to handle class imbalanced medi
UVa 11732 – strcmp() Anyone?
Detailed explanation of ThreadLocal
On file uploading of network security
MySQL authentication bypass vulnerability (cve-2012-2122)
UDP编程
Redis 持久化机制
Should novice programmers memorize code?
树的先序中序后序遍历
专为决策树打造,新加坡国立大学&清华大学联合提出快速安全的联邦学习新系统
OpenNMS分离数据库
Method of canceling automatic watermarking of uploaded pictures by CSDN
European Bioinformatics Institute 2021 highlights report released: nearly 1million proteins have been predicted by alphafold
Matlab tips (27) grey prediction
Mysql 身份认证绕过漏洞(CVE-2012-2122)
NPDP certification | how do product managers communicate across functions / teams?
uniapp滑动到一定的高度后固定某个元素到顶部效果demo(整理)
Inno setup packaging and signing Guide
pytorch_ Yolox pruning [with code]