当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript cancelSync.update方法代码示例

本文整理汇总了TypeScript中framesync.cancelSync.update方法的典型用法代码示例。如果您正苦于以下问题:TypeScript cancelSync.update方法的具体用法?TypeScript cancelSync.update怎么用?TypeScript cancelSync.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在framesync.cancelSync的用法示例。


在下文中一共展示了cancelSync.update方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: updateTween

 process = sync.update(({ delta }) => {
   // TODO Maybe try something different to eat the variations in framerate
   elapsed += delta * playDirection;
   updateTween();
   if (isTweenComplete() && complete) {
     cancelSync.update(process);
     sync.update(complete, false, true);
   }
 }, true);
开发者ID:Popmotion,项目名称:popmotion,代码行数:9,代码来源:index.ts

示例2: update

    const process = sync.update(({ delta: frameDelta }) => {
      elapsed += frameDelta;
      const delta = -amplitude * Math.exp(-elapsed / timeConstant);
      const isMoving = delta > restDelta || delta < -restDelta;
      const current = isMoving ? target + delta : target;

      update(current);

      if (!isMoving) {
        cancelSync.update(process);
        complete();
      }
    }, true);
开发者ID:Popmotion,项目名称:popmotion,代码行数:13,代码来源:index.ts

示例3: speedPerSecond

      const process = sync.update(({ delta: timeDelta }) => {
        t += timeDelta;

        const dampingRatio = damping / (2 * Math.sqrt(stiffness * mass));
        const angularFreq = Math.sqrt(stiffness / mass) / 1000;

        prevPosition = position;

        // Underdamped
        if (dampingRatio < 1) {
          const envelope = Math.exp(-dampingRatio * angularFreq * t);
          const expoDecay =
            angularFreq * Math.sqrt(1.0 - dampingRatio * dampingRatio);

          position =
            to -
            envelope *
              (((initialVelocity + dampingRatio * angularFreq * delta) /
                expoDecay) *
                Math.sin(expoDecay * t) +
                delta * Math.cos(expoDecay * t));
        } else {
          const envelope = Math.exp(-angularFreq * t);
          position =
            to -
            envelope * (delta + (initialVelocity + angularFreq * delta) * t);
        }

        velocity = speedPerSecond(position - prevPosition, timeDelta);

        // Check if simulation is complete
        // We do this here instead of `isActionComplete` as it allows us
        // to clamp to end during update)
        const isBelowVelocityThreshold = Math.abs(velocity) <= restSpeed;
        const isBelowDisplacementThreshold =
          Math.abs(to - position) <= restDelta;

        if (isBelowVelocityThreshold && isBelowDisplacementThreshold) {
          position = to;
          update(position);
          cancelSync.update(process);
          complete();
        } else {
          update(position);
        }
      }, true);
开发者ID:Popmotion,项目名称:popmotion,代码行数:46,代码来源:index.ts

示例4: speedPerFrame

      const process = sync.update(({ delta }) => {
        // Integration doesn't work well with very low numbers
        const elapsed = Math.max(delta, 16);

        if (acceleration) velocity += speedPerFrame(acceleration, elapsed);
        if (friction) velocity *= (1 - friction) ** (elapsed / 100);

        if (springStrength !== undefined && to !== undefined) {
          const distanceToTarget = to - current;
          velocity += distanceToTarget * speedPerFrame(springStrength, elapsed);
        }

        current += speedPerFrame(velocity, elapsed);

        update(current);

        const isComplete =
          restSpeed !== false && (!velocity || Math.abs(velocity) <= restSpeed);

        if (isComplete) {
          cancelSync.update(process);
          complete();
        }
      }, true);
开发者ID:Popmotion,项目名称:popmotion,代码行数:24,代码来源:index.ts

示例5:

 stop: () => {
   cancelSync.update(updatePoint);
   updateOnMove.stop();
 }
开发者ID:Popmotion,项目名称:popmotion,代码行数:4,代码来源:index.ts

示例6:

 stop: () => cancelSync.update(process)
开发者ID:Popmotion,项目名称:popmotion,代码行数:1,代码来源:index.ts


注:本文中的framesync.cancelSync.update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。