当前位置:网站首页>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 :
边栏推荐
- 关于声子和热输运计算中BORN电荷和non-analytic修正的问题
- 案例推荐丨安擎携手伙伴,保障“智慧法院”更加高效
- Word2vec (skip gram and cbow) - pytorch
- UDP programming
- 如何实现文字动画效果
- 监控界的最强王者,没有之一!
- Mysql database basic operations DML
- Config:invalid signature solution and troubleshooting details
- Sword finger offer question brushing record 1
- 2022-07-05 stonedb sub query processing parsing time analysis
猜你喜欢

室内LED显示屏应该怎么选择?这5点注意事项必须考虑在内

rust知识思维导图xmind

ACL 2022 | small sample ner of sequence annotation: dual tower Bert model integrating tag semantics

Leetcode exercise - Sword finger offer 26 Substructure of tree

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

Improving Multimodal Accuracy Through Modality Pre-training and Attention

Unified Focal loss: Generalising Dice and cross entropy-based losses to handle class imbalanced medi
DockerMySQL无法被宿主机访问的问题解决

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

How to confirm the storage mode of the current system by program?
随机推荐
【LeetCode】19、 删除链表的倒数第 N 个结点
Aardio - Method of batch processing attributes and callback functions when encapsulating Libraries
Web APIs DOM time object
Should novice programmers memorize code?
Is there any requirement for the value after the case keyword?
BasicVSR_ Plusplus master test videos and pictures
Extern keyword
Introduction to network basics
第十九章 使用工作队列管理器(二)
2022-07-04 the high-performance database engine stonedb of MySQL is compiled and run in centos7.9
three. JS gorgeous bubble effect
金融人士必读书籍系列之六:权益投资(基于cfa考试内容大纲和框架)
【编译原理】做了一半的LR(0)分析器
「小程序容器技术」,是噱头还是新风口?
案例推荐丨安擎携手伙伴,保障“智慧法院”更加高效
MySQL教程的天花板,收藏好,慢慢看
云原生技术--- 容器知识点
做国外LEAD2022年下半年几点建议
剑指offer刷题记录1
动作捕捉用于蛇运动分析及蛇形机器人开发