Commit aef7ab70 authored by liujiangnan's avatar liujiangnan

feat: 进度条

parent b53b83f6
This diff is collapsed.
...@@ -350,14 +350,17 @@ cc.Class({ ...@@ -350,14 +350,17 @@ cc.Class({
this.currentTimeLabel.string = this.formatTime(ct); this.currentTimeLabel.string = this.formatTime(ct);
const dur = this.videoPlayer.getDuration(); const dur = this.videoPlayer.getDuration();
const percent = ct / dur; const percent = ct / dur;
if (percent > 1) {
percent = 1
}
this.ProgressBar.getComponent(cc.ProgressBar).progress = percent;
const maxX = this.ProgressBar.width; const maxX = this.ProgressBar.width;
const minX = 0; const minX = 0;
let newX = percent * maxX; let newX = percent * maxX;
newX = Math.min(maxX, Math.max(newX, minX)); newX = Math.min(maxX, Math.max(newX, minX));
this.barTag.x = newX>=(maxX-90)?(maxX-90):(newX-15); this.barTag.x = newX;
this.bar.width = newX;
this.bar.x = 0 - (maxX / 2);
}, },
formatTime(time) { formatTime(time) {
if (time === undefined) { if (time === undefined) {
return ''; return '';
......
assets/ngt_video/Texture/video/process.png

852 Bytes | W: | H:

assets/ngt_video/Texture/video/process.png

1.44 KB | W: | H:

assets/ngt_video/Texture/video/process.png
assets/ngt_video/Texture/video/process.png
assets/ngt_video/Texture/video/process.png
assets/ngt_video/Texture/video/process.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -22,14 +22,14 @@ ...@@ -22,14 +22,14 @@
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 211, "width": 1376,
"height": 21, "height": 21,
"rawWidth": 211, "rawWidth": 1376,
"rawHeight": 21, "rawHeight": 21,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 11, "borderLeft": 8,
"borderRight": 9, "borderRight": 8,
"subMetas": {} "subMetas": {}
} }
} }
......
assets/ngt_video/Texture/video/processbg.png

988 Bytes | W: | H:

assets/ngt_video/Texture/video/processbg.png

1004 Bytes | W: | H:

assets/ngt_video/Texture/video/processbg.png
assets/ngt_video/Texture/video/processbg.png
assets/ngt_video/Texture/video/processbg.png
assets/ngt_video/Texture/video/processbg.png
  • 2-up
  • Swipe
  • Onion skin
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment