首页 > 解决方案 > 使用 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;
  }

标签: javascriptnode.jsangulartypescriptgsap

解决方案


推荐阅读