Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"string-replace-loader": "^2.2.0",
"webpack": "^4.39.1",
"webpack-cli": "^3.3.6",
"lottie-web": "^5.7.4",
"lottie-web": "5.5.7",
"copy-webpack-plugin": "^6.0.3"
}
}
14 changes: 6 additions & 8 deletions src/adapter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,15 @@ export const setup = (canvas) => {
g._cancelAnimationFrame = window.cancelAnimationFrame
// lottie 对象是单例,内部状态(_stopped)在多页面下会混乱,保持 rAF 持续运行可规避
window.requestAnimationFrame = function requestAnimationFrame(cb) {
let called = false
if(typeof canvas.requestAnimationFrame === 'function'){
canvas.requestAnimationFrame((timeStamp) => {
typeof cb === 'function' && cb(timeStamp)
})
return
}
setTimeout(() => {
if (called) return
called = true
typeof cb === 'function' && cb(Date.now())
}, 100)
canvas.requestAnimationFrame((timeStamp) => {
if (called) return
called = true
typeof cb === 'function' && cb(timeStamp)
})
}
window.cancelAnimationFrame = canvas.cancelAnimationFrame.bind(canvas)

Expand Down
2 changes: 0 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ module.exports = {
rules: [{
test: /\.js$/i,
use: [{
loader: 'eslint-loader',
}, {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
Expand Down
Loading