javascript - 使用 Math 对象在加载器栏中加载 100%
问题描述
我正在使用 Gsap 并使用 TimelineLite 对象进行加载程序处理并使用 Math.round 对象显示百分比内容但它没有显示准确的测量它显示 67% 而不是 100% 示例
ngOnInit() {
const timer = 4;
this.master = new TimelineLite();
this.master.to(this.progress.nativeElement, timer, this.progressLoader(this.master));
this.master.to(this.panel.nativeElement, 2, this.verticalShow(this.master));
}
progressLoader(obj: any) {
let newPercent: any;
this.count = this.count.nativeElement;
const vars = {
width: '100%',
ease: Power2.easeOut,
onUpdate: () => {
console.log(newPercent = Math.round((obj.progress() * 100)));
this.count.innerHTML = newPercent + '%';
}
};
return vars;
}
解决方案
推荐阅读
- bash - 移动已老化 x 分钟的文件
- c - 函数内部变量的变量类型
- excel - CountIF 使用公式中的数组和条件返回 0
- reactjs - 在 React 的 pre-hooks 版本中使用使用 Context API 的 React npm 库
- data-structures - 数据结构递归关系
- bash - mac 上没有显示环境变量
- java - 在 try/catch 块中捕获异常后继续执行循环
- javascript - 如何使用three.js创建粘性视频效果?
- c++ - 如何实时捕捉摄像头的视频?
- android - Android Studio 无法更新和解析 XML 中的更改以进行预览