mirror of
https://github.com/openstf/stf
synced 2025-10-05 10:39:25 +02:00
- Introducing requestAnimationFrame
This commit is contained in:
parent
180bc42f38
commit
defda72fc1
3 changed files with 24 additions and 2 deletions
|
@ -391,6 +391,15 @@ function FastImageRender(canvasElement, options) {
|
|||
this.options = options || {}
|
||||
this.canvasElement = canvasElement
|
||||
|
||||
if (that.options.raf) {
|
||||
that.animLoop = function() {
|
||||
that.raf = that.animLoop)
|
||||
|
||||
// separate render from drawing
|
||||
// render
|
||||
}
|
||||
}
|
||||
|
||||
if (true) {
|
||||
this.loader = new Image()
|
||||
this.loader.onload = function () {
|
||||
|
@ -414,6 +423,13 @@ function FastImageRender(canvasElement, options) {
|
|||
|
||||
}
|
||||
|
||||
FastImageRender.prototype.destroy = function () {
|
||||
|
||||
cancelAnimationFrame(this.raf)
|
||||
|
||||
// delete onLoad & onError
|
||||
}
|
||||
|
||||
FastImageRender.prototype.load = function (url, type) {
|
||||
var that = this
|
||||
|
||||
|
@ -438,6 +454,7 @@ FastImageRender.prototype.load = function (url, type) {
|
|||
}
|
||||
|
||||
} else {
|
||||
|
||||
this.loader.src = url
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue