当前位置:网站首页>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 :
边栏推荐
猜你喜欢
Cocoscreator+typescripts write an object pool by themselves
Introduction to network basics
rust知识思维导图xmind
Rust knowledge mind map XMIND
DR-Net: dual-rotation network with feature map enhancement for medical image segmentation
DR-Net: dual-rotation network with feature map enhancement for medical image segmentation
监控界的最强王者,没有之一!
MySQL ---- first acquaintance with MySQL
Aardio - does not declare the method of directly passing float values
Balanced Multimodal Learning via On-the-fly Gradient Modulation(CVPR2022 oral)
随机推荐
企业不想换掉用了十年的老系统
欧洲生物信息研究所2021亮点报告发布:采用AlphaFold已预测出近1百万个蛋白质
专为决策树打造,新加坡国立大学&清华大学联合提出快速安全的联邦学习新系统
MATLAB小技巧(27)灰色预测
The difference between enumeration and define macro
Motion capture for snake motion analysis and snake robot development
UVa 11732 – strcmp() Anyone?
Rust knowledge mind map XMIND
rust知识思维导图xmind
Designed for decision tree, the National University of Singapore and Tsinghua University jointly proposed a fast and safe federal learning system
Clip +json parsing converts the sound in the video into text
【全网首发】Redis系列3:高可用之主从架构的
three.js绚烂的气泡效果
OpenSSL:适用TLS与SSL协议的全功能工具包,通用加密库
uniapp滑动到一定的高度后固定某个元素到顶部效果demo(整理)
Detailed explanation of ThreadLocal
Dealing with the crash of QT quick project in offscreen mode
AdaViT——自适应选择计算结构的动态网络
Dayu200 experience officer runs the intelligent drying system page based on arkui ETS on dayu200
CocosCreator+TypeScripts自己写一个对象池