当前位置:网站首页>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 :
边栏推荐
- UVa 11732 – strcmp() Anyone?
- Adavit -- dynamic network with adaptive selection of computing structure
- Designed for decision tree, the National University of Singapore and Tsinghua University jointly proposed a fast and safe federal learning system
- ThreadLocal详解
- Windows Auzre 微软的云计算产品的后台操作界面
- Mysql 身份认证绕过漏洞(CVE-2012-2122)
- MySQL教程的天花板,收藏好,慢慢看
- Balanced Multimodal Learning via On-the-fly Gradient Modulation(CVPR2022 oral)
- C# 三种方式实现Socket数据接收
- Uniapp setting background image effect demo (sorting)
猜你喜欢

视图(view)

#DAYU200体验官# 首页aito视频&Canvas绘制仪表盘(ets)

剑指offer刷题记录1

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

How to confirm the storage mode of the current system by program?

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

Leetcode: interview question 17.24 Maximum cumulative sum of submatrix (to be studied)

ICLR 2022 | pre training language model based on anti self attention mechanism

AdaViT——自适应选择计算结构的动态网络

ACL 2022 | 序列标注的小样本NER:融合标签语义的双塔BERT模型
随机推荐
Classification, function and usage of MySQL constraints
poj 1094 Sorting It All Out (拓扑排序)
第十九章 使用工作队列管理器(二)
Void keyword
DR-Net: dual-rotation network with feature map enhancement for medical image segmentation
Introduction to network basics
Volatile keyword
Financial professionals must read book series 6: equity investment (based on the outline and framework of the CFA exam)
MySQL authentication bypass vulnerability (cve-2012-2122)
The statement that allows full table scanning does not seem to take effect set odps sql. allow. fullscan=true; I
POJ 1094 sorting it all out
企业不想换掉用了十年的老系统
QT signal and slot
Sizeof keyword
Config:invalid signature solution and troubleshooting details
DR-Net: dual-rotation network with feature map enhancement for medical image segmentation
Sword finger offer question brushing record 1
专为决策树打造,新加坡国立大学&清华大学联合提出快速安全的联邦学习新系统
自定义 swap 函数
Aardio - integrate variable values into a string of text through variable names