亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

better-scroll 插件源碼中 momentum 函數 ,動量公式推導的?如何學習呢

better-scroll 插件源碼中 momentum 函數 ,動量公式推導的?如何學習呢

Arey_jy 2017-08-22 11:56:31
//?this.x,?this.startX,?duration,?this.maxScrollX|Y,?this.options.bounce???this.wrapperWidth|Height?:?0,?this.options???? export?function?momentum(current,?start,?time,?lowerMargin,?wrapperSize,?options)?{???? let?distance?=?current?-?start;???? let?speed?=?Math.abs(distance)?/?time;???? //??deceleration?=?0.001,?itemHeight,?swipeBounceTime?=?1200,?bounceTime?=?700???? let?{deceleration,?itemHeight,?swipeBounceTime,?bounceTime}?=?options;???? //?swipeTime?=?2500???? let?duration?=?options.swipeTime;???? let?rate?=?options.wheel???4?:?15;???? //????? //?(distance?<?0???-1?:?1)?判斷往上滾動,還是往下滾動???? let?destination?=?current?+?speed?/?deceleration?*?(distance?<?0???-1?:?1);???? if?(options.wheel?&&?itemHeight)?{???? destination?=?Math.round(destination?/?itemHeight)?*?itemHeight;???? }???? //?destination?<?lowerMargin判斷往(下|右)方向,?destination?>?0?相反???? if?(destination?<?lowerMargin)?{???? //????? destination?=?wrapperSize???lowerMargin?-?(wrapperSize?/?rate?*?speed)?:?lowerMargin;???? duration?=?swipeBounceTime?-?bounceTime;???? }?else?if?(destination?>?0)?{???? //???? destination?=?wrapperSize???wrapperSize?/?rate?*?speed?:?0;???? duration?=?swipeBounceTime?-?bounceTime;???? }???? return?{???? destination:?Math.round(destination),???? duration???? };???? };
查看完整描述

目前暫無任何回答

  • 0 回答
  • 0 關注
  • 1909 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號