summaryrefslogtreecommitdiff
path: root/site/public/assets/javascripts/_env.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-04-16 15:27:32 -0400
committerJules Laplace <jules@okfoc.us>2015-04-16 15:27:32 -0400
commitf89bcac33410334863762cdf5071629db30456dd (patch)
treefc485185c7d6faf1e762e9fe645560dfff66f1a7 /site/public/assets/javascripts/_env.js
parent48923c16e00892fac916a83c8fdccca63800615f (diff)
toggle menu when clicking shape
Diffstat (limited to 'site/public/assets/javascripts/_env.js')
-rw-r--r--site/public/assets/javascripts/_env.js74
1 files changed, 60 insertions, 14 deletions
diff --git a/site/public/assets/javascripts/_env.js b/site/public/assets/javascripts/_env.js
index b567a3d..31b10b7 100644
--- a/site/public/assets/javascripts/_env.js
+++ b/site/public/assets/javascripts/_env.js
@@ -52,7 +52,6 @@ environment.ready = function(){
$loader.load(page + " .entry", function(){
display_entry($loader.children()[0])
})
-
})
$("nav .about").click(function(e){
@@ -164,15 +163,7 @@ environment.ready = function(){
}
setTimeout(function(){ done_loading = true }, 200)
-// $(".mx-scenery").on("mouseenter", function(e){
-// e.stopPropagation()
-// $(this).addClass("red")
-// })
-// $(".mx-scenery").on("mouseleave", function(e){
-// e.stopPropagation()
-// $(".red").removeClass("red")
-// })
-
+
$(document).on('webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange', function(){
setTimeout(function(){
if (window.innerHeight == screen.height) {
@@ -193,6 +184,7 @@ function build_scene () {
controls.setZoom(100000)
controls.zoom(1000)
+/*
strips.push( new Strip({
images: $(".sub[data-type=advertising] a"),
x: -100,
@@ -228,11 +220,58 @@ function build_scene () {
rotationY: PI/100,
offset: 200,
}) )
+*/
+
+ strips.push( new Strip({
+ images: boxImages.slice(0, 5),
+ x: -100,
+ y: 100,
+ rotationY: PI/4,
+ offset: 100,
+ }) )
+
+ strips.push( new Strip({
+ images: boxImages.slice(5, 10),
+ x: 100,
+ y: 100,
+ rotationX: PI/4,
+ rotationY: PI/-100,
+ offset: 200,
+ }) )
+
+ strips.push( new Strip({
+ images: boxImages.slice(10, 15),
+ x: 0,
+ y: 100,
+ z: 100,
+ rotationY: PI/6,
+ offset: 300,
+ }) )
+
+ strips.push( new Strip({
+ images: boxImages.slice(15, 20),
+ x: 0,
+ y: 100,
+ z: -50,
+ rotationX: PI/2,
+ rotationY: PI/100,
+ offset: 200,
+ }) )
strips.forEach(function(strip){ strip.update(0) })
scene.update()
environment.update = environment.updateOnReady
+
+ $("#scene_container").click(function(e){
+ if ( $("body").hasClass("menuActive") ) {
+ return
+ }
+ else {
+ toggle_menu()
+ }
+ })
+
}
var entry_open_time = 0;
@@ -312,6 +351,7 @@ function toggle_menu (){
if (menu_open) {
controls.pause()
+ $(".index").trigger("click")
}
if (! menu_open && entry_open && ! is_mobile) {
entry_open = false
@@ -321,7 +361,6 @@ function toggle_menu (){
}
if (! menu_open && ! entry_open) {
window.location.hash = "#"
- console.log("what")
$("#scene").show()
$("#entry_container").empty()
controls.zoom(1500)
@@ -458,10 +497,17 @@ var Strip = function( opt ){
root.addTo(scene)
var prev = root
- this.els = opt.images.toArray().map(function(el, i){
- var data = $(el).data()
+ this.els = ( opt.images.toArray ? opt.images.toArray() : opt.images ).map(function(el, i){
+ var url
+ if (typeof el == "string") {
+ url = el
+ }
+ else {
+ var data = $(el).data()
+ url = data.image
+ }
var el = new MX.Image({
- src: data.image,
+ src: url,
onload: function(img){
}
})