diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-08-05 12:53:38 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-08-05 12:53:38 -0400 |
| commit | b9aaeaf616ed0a46a81e313bede00f1598d245ca (patch) | |
| tree | 0d2256c9332b6d0ef97bb56e1c771a976f3497db /public/js/lib/bg.js | |
| parent | 21e31e46ff167ede7cb5ad4452cbd406236bc83d (diff) | |
| parent | 3b7da491072e5c366738ff549e8958d97948076a (diff) | |
mergez
Diffstat (limited to 'public/js/lib/bg.js')
| -rw-r--r-- | public/js/lib/bg.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/public/js/lib/bg.js b/public/js/lib/bg.js new file mode 100644 index 0000000..6fa75d5 --- /dev/null +++ b/public/js/lib/bg.js @@ -0,0 +1,28 @@ +var bg = (function(){ + + var bg = {} + bg.el = document.getElementById("bg") + + bg.change = function(picture){ + var img = new Image () + img.src = picture.url + oktween.add({ + obj: bg.el.style, + from: { opacity: 1 }, + to: { opacity: 0 }, + easing: "circ_in", + duration: 500, + finished: function(){ + bg.el.style.backgroundImage = "url(" + picture.url + ")" + bg.el.className = picture.tile ? "tile" : "" + } + }).then({ + delay: 500, + to: { opacity: 1 }, + easing: "circ_in", + duration: 500, + }) + } + return bg + +})()
\ No newline at end of file |
