diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-04-16 14:41:58 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-04-16 15:15:02 -0400 |
| commit | 48923c16e00892fac916a83c8fdccca63800615f (patch) | |
| tree | 18bf1908ce07c397202ea2cefdcdb869d28041d1 /site/public/assets/javascripts/_env.js | |
| parent | 3f26845f934e95a5c3f9486f83f715240347bbcd (diff) | |
load shape images from posts
Diffstat (limited to 'site/public/assets/javascripts/_env.js')
| -rw-r--r-- | site/public/assets/javascripts/_env.js | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/site/public/assets/javascripts/_env.js b/site/public/assets/javascripts/_env.js index c4e9ace..b567a3d 100644 --- a/site/public/assets/javascripts/_env.js +++ b/site/public/assets/javascripts/_env.js @@ -7,8 +7,11 @@ environment.init = function(){ $("#scene").addClass("fade") var loader = new Loader(environment.ready, new HustleLoader) var preloadImages = $("#preload-image-list").html().split("\n").filter(function(s){ return !!s }) - boxImages = $("#box-image-list").html().split("\n").filter(function(s){ return !!s }) - loader.preloadImages( preloadImages.concat(boxImages) ) + boxImages = $("#box-image-list").html().split("\n") + var postImages = $(".sub a").toArray().map(function(el){ return $(el).data("image") }) + + var images = preloadImages.concat(postImages).concat(boxImages).filter(function(s){ return !!s }) + loader.preloadImages( images ) loader.ready() } environment.ready = function(){ @@ -191,7 +194,7 @@ function build_scene () { controls.zoom(1000) strips.push( new Strip({ - images: boxImages.slice(0, 5), + images: $(".sub[data-type=advertising] a"), x: -100, y: 100, rotationY: PI/4, @@ -199,7 +202,7 @@ function build_scene () { }) ) strips.push( new Strip({ - images: boxImages.slice(5, 10), + images: $(".sub[data-type=retail] a"), x: 100, y: 100, rotationX: PI/4, @@ -208,7 +211,7 @@ function build_scene () { }) ) strips.push( new Strip({ - images: boxImages.slice(10, 15), + images: $(".sub[data-type=experiential] a"), x: 0, y: 100, z: 100, @@ -217,7 +220,7 @@ function build_scene () { }) ) strips.push( new Strip({ - images: boxImages.slice(15, 20), + images: $(".sub[data-type=content] a"), x: 0, y: 100, z: -50, @@ -455,9 +458,10 @@ var Strip = function( opt ){ root.addTo(scene) var prev = root - this.els = opt.images.map(function(url, i){ + this.els = opt.images.toArray().map(function(el, i){ + var data = $(el).data() var el = new MX.Image({ - src: url, + src: data.image, onload: function(img){ } }) |
