MCPcopy Create free account
hub / github.com/MankaiHuang/screen-visualization / initAnimation

Function initAnimation

public/iframe/lib/js/mixinsComponents.js:558–586  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

556 },
557 methods: {
558 initAnimation() {
559 clearInterval(this.timer);
560 const step = Number(this.option.liHeight) + 42; // 42是各种边框的大小
561 const that = this;
562 // 计算总共有多少条数据
563 const maxDataLength = this.option.data.length;
564 // 一页显示多少条数据 当前页面高度 / liHeight 取整
565 const onePageCount = Math.round(
566 (this.$refs.listContent.offsetHeight || 400) / step,
567 );
568 that.timer = setInterval(() => {
569 if (
570 that.currentIndex >=
571 maxDataLength - onePageCount + Math.round(onePageCount / 2)
572 ) {
573 if (that.$refs.liX !== undefined) {
574 setTimeout(() => {
575 that.$refs.liX.style.marginTop = '0px';
576 that.currentIndex = 0;
577 }, 1000);
578 }
579 } else {
580 const nowStep = that.currentIndex++ * step;
581 if (that.$refs.liX !== undefined) {
582 that.$refs.liX.style.marginTop = `-${nowStep}px`;
583 }
584 }
585 }, this.option.Animationtime * 1000);
586 },
587 getBorder() {
588 return `1px dotted ${this.option.indexBorderColor}`
589 }

Callers

nothing calls this directly

Calls 1

setTimeoutFunction · 0.85

Tested by

no test coverage detected