blob: 4d6dfb8e69a0dd4f1b8ff27db3d47fc722a67135 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
var bg = (function(){
var bg = {}
var transitioning = false
bg.el = document.getElementById("bg")
bg.change = function(picture){
bg.picture = picture
var img = new Image ()
img.src = picture.url
transitioning = true
if (transitioning) {
bg.update()
return
}
oktween.add({
obj: bg.el.style,
from: { opacity: 1 },
to: { opacity: 0 },
easing: "circ_in",
duration: 200,
finished: function(){
bg.update()
}
}).then({
delay: 500,
to: { opacity: 1 },
easing: "circ_in",
duration: 200,
finished: function(){
transitioning = false
}
})
}
bg.update = function(){
bg.el.style.backgroundImage = "url(" + bg.picture.url + ")"
bg.el.className = bg.picture.tile ? "tile" : ""
}
return bg
})()
|