How to use the @better-scroll/shared-utils.ease.bounce function in @better-scroll/shared-utils

To help you get started, we’ve selected a few @better-scroll/shared-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ustbhuangyi / better-scroll / packages / core / src / scroller / Scroller.ts View on Github external
this.hooks.trigger(this.hooks.eventTypes.touchEnd, pos)

        if (this.hooks.trigger(this.hooks.eventTypes.end, pos)) {
          return true
        }

        // check if it is a click operation
        if (!actions.moved && this.checkClick(e)) {
          this.animater.setForceStopped(false)
          this.hooks.trigger(this.hooks.eventTypes.scrollCancel)
          return true
        }
        this.animater.setForceStopped(false)

        // reset if we are outside of the boundaries
        if (this.resetPosition(this.options.bounceTime, ease.bounce)) {
          return true
        }
      }
    )
github ustbhuangyi / better-scroll / packages / core / src / scroller / Scroller.ts View on Github external
resetPosition(time = 0, easing?: EaseItem) {
    easing = !easing ? ease.bounce : easing
    const {
      position: x,
      inBoundary: xInBoundary
    } = this.scrollBehaviorX.checkInBoundary()
    const {
      position: y,
      inBoundary: yInBoundary
    } = this.scrollBehaviorY.checkInBoundary()

    if (xInBoundary && yInBoundary) {
      return false
    }

    // out of boundary
    this.scrollTo(x, y, time, easing)
github ustbhuangyi / better-scroll / packages / core / src / scroller / Scroller.ts View on Github external
scrollTo(
    x: number,
    y: number,
    time = 0,
    easing?: EaseItem,
    extraTransform = {
      start: {},
      end: {}
    },
    isSilent?: boolean
  ) {
    easing = !easing ? ease.bounce : easing
    const easingFn = this.options.useTransition ? easing.style : easing.fn
    const currentPos = this.getCurrentPos()

    const startPoint = {
      x: currentPos.x,
      y: currentPos.y,
      ...extraTransform.start
    }
    const endPoint = {
      x,
      y,
      ...extraTransform.end
    }

    this.hooks.trigger(this.hooks.eventTypes.scrollTo, endPoint)
    if (!this.hooks.trigger(this.hooks.eventTypes.ignoreDisMoveForSamePos)) {
github ustbhuangyi / better-scroll / packages / core / src / scroller / Scroller.ts View on Github external
private transitionEnd(e: TouchEvent) {
    if (e.target !== this.content || !this.animater.pending) {
      return
    }
    const animater = this.animater as Transition
    animater.transitionTime()

    if (!this.resetPosition(this.options.bounceTime, ease.bounce)) {
      this.animater.setPending(false)
      if (this.options.probeType !== Probe.Realtime) {
        this.hooks.trigger(
          this.hooks.eventTypes.scrollEnd,
          this.getCurrentPos()
        )
      }
    }
  }
github ustbhuangyi / better-scroll / packages / pull-down / src / index.ts View on Github external
finish() {
    this.pulling = false
    this.scroll.minScrollY = this.originalMinScrollY
    this.scroll.resetPosition(this.scroll.options.bounceTime, ease.bounce)
  }