Skip to content

Commit

Permalink
Merge shit
Browse files Browse the repository at this point in the history
  • Loading branch information
GCalmels committed Dec 5, 2014
2 parents 1cc4aa2 + 74795d2 commit e10f4c8
Show file tree
Hide file tree
Showing 17 changed files with 270 additions and 67 deletions.
1 change: 0 additions & 1 deletion src/CG/PlatformBundle/Entity/EventRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@ public function findByEnabledWithOrder($enabled)
{
return $this->findBy(array('enabled' => $enabled), array('id' => 'DESC'));
}

}
6 changes: 6 additions & 0 deletions src/CG/PlatformBundle/Resources/public/css/animate.min.css

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions src/CG/PlatformBundle/Resources/public/css/home_overlay.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#overlay
{
width: 500px;
height: 500px;
position: absolute;
margin: 0;
padding: 0;
left: 0;
right: 0;
top: 0;
background-color: transparent;
display: none;
z-index: 3;
background-repeat: no-repeat;

-moz-animation-duration: 3s;
-moz-animation-delay: 0s;
-moz-animation-iteration-count: 1;

-webkit-animation-duration: 3s;
-webkit-animation-delay: 0s;
-webkit-animation-iteration-count: 1;

-ms-animation-duration: 3s;
-ms-animation-delay: 0s;
-ms-animation-iteration-count: 1;

-o-animation-duration: 3s;
-o-animation-delay: 0s;
-o-animation-iteration-count: 1;
}
138 changes: 84 additions & 54 deletions src/CG/PlatformBundle/Resources/public/js/earth.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ var windowHalfY = window.innerHeight / 2;
var earthMesh;

// Mouse object
var mouse = {x : 0, y : 0, isClicked: false};
var mouse = {x : -0.01, y : 0, isClicked: false};

var objects = [];

init();
animate();
Expand Down Expand Up @@ -41,11 +43,20 @@ function init()
var manager = new THREE.LoadingManager();
var texture = new THREE.Texture();

var onProgress = function ( xhr ) {
console.log('On Progress')
};

var onError = function ( xhr ) {
//console.log('An error has occured');
console.log(xhr)
};

var loader = new THREE.ImageLoader( manager );
loader.load( '../img/earthTexture.jpg', function ( image ) {
texture.image = image;
texture.needsUpdate = true;
} );
loader.load( '../img/earthTexture.jpg', function ( image ) {
texture.image = image;
texture.needsUpdate = true;
}, onProgress, onError);

var geometry = new THREE.SphereGeometry(0.5, 32, 32)
var material = new THREE.MeshPhongMaterial()
Expand All @@ -62,21 +73,24 @@ function init()
var pos = latLongToVector3(lat, lon, 0.5, 0)

var geometry = new THREE.SphereGeometry(0.02,32,32);
var material = new THREE.MeshBasicMaterial( { color: 0xFA2A2A } );
var cube = new THREE.Mesh( geometry, material );
cube.position.x = pos.x;
cube.position.y = pos.y;
cube.position.z = pos.z;
var material = new THREE.MeshLambertMaterial( { color: 0xE61E17 , ambient: 0x909090} );
material.transparent = true;
material.opacity = 0.8;
var pin = new THREE.Mesh( geometry, material );
pin.position.x = pos.x;
pin.position.y = pos.y;
pin.position.z = pos.z;

earthMesh.add(cube);
pin.name = value.link;

objects.push(pin);

earthMesh.add(pin);
});
});
/*
// 34.909568, 38.991521
// 45.926093, 4.832203

console.log(objects)
});

*/
// Rendering
renderer = new THREE.WebGLRenderer({alpha:true});
renderer.setClearColor( 0xffffff, 1);
Expand All @@ -101,57 +115,73 @@ function onWindowResize()
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();

renderer.setSize( window.innerWidth / 2, window.innerHeight / 2 );
renderer.setSize( window.innerWidth/2, window.innerHeight/2 );
}


document.addEventListener('mousemove', function(event)
{
if(mouse.isClicked)
{
mouse.x = (event.clientX / window.innerWidth ) - 0.5
mouse.y = (event.clientY / window.innerHeight) - 0.5
}
}, false)
{
mouse.x = (event.clientX / window.innerWidth ) - 0.5
mouse.y = (event.clientY / window.innerHeight) - 0.5
}
}, false)

document.addEventListener('mousedown', function(event)
{
mouse.isClicked = true;
})
document.addEventListener('mousedown', function(event)
{
mouse.isClicked = true;
//console.log(objects)
var projector = new THREE.Projector();
var mouse3D = new THREE.Vector3( ( event.clientX / window.innerWidth ) * 2 - 1, //x
-( event.clientY / window.innerHeight ) * 2 + 1, //y
0.5 ); //z
var raycaster = projector.pickingRay( mouse3D.clone(), camera );
// Intercept the position of the click
var intersects = raycaster.intersectObjects( objects );

if ( intersects.length > 0 ) {
var object = intersects[ 0 ].object
object.onclick = window.open(object.name)
}

})

document.addEventListener('mouseup', function(event)
{
mouse.isClicked = false;
mouse.x = 0;
mouse.y = 0;
})

document.addEventListener('mouseup', function(event)
{
mouse.isClicked = false;
mouse.x = 0;
mouse.y = 0;
})
function animate()
{
requestAnimationFrame( animate );

function animate()
{
requestAnimationFrame( animate );
render();
}
render();
}

function render()
{
if(!( (mouse.y>0 && earthMesh.rotation.x>1) || (mouse.y<0 && earthMesh.rotation.x<-1) ) )
function render()
{
earthMesh.rotation.x += mouse.y/10
}
earthMesh.rotation.y += mouse.x/5
if(!( (mouse.y>0 && earthMesh.rotation.x>1) || (mouse.y<0 && earthMesh.rotation.x<-1) ) )
{
earthMesh.rotation.x += mouse.y/10
}
earthMesh.rotation.y += mouse.x/5

camera.lookAt( scene.position )
camera.lookAt( scene.position )

renderer.render( scene, camera );
}
renderer.render( scene, camera );
}

function latLongToVector3(lat, lon, radius, heigth) {
var phi = (lat)*Math.PI/180;
var theta = (lon-180)*Math.PI/180;
function latLongToVector3(lat, lon, radius, heigth) {
var phi = (lat)*Math.PI/180;
var theta = (lon-180)*Math.PI/180;

var x = -(radius+heigth) * Math.cos(phi) * Math.cos(theta);
var y = (radius+heigth) * Math.sin(phi);
var z = (radius+heigth) * Math.cos(phi) * Math.sin(theta);
var x = -(radius+heigth) * Math.cos(phi) * Math.cos(theta);
var y = (radius+heigth) * Math.sin(phi);
var z = (radius+heigth) * Math.cos(phi) * Math.sin(theta);

return new THREE.Vector3(x,y,z);
}
return new THREE.Vector3(x,y,z);
}

Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions src/CG/PlatformBundle/Resources/public/js/ion.sound.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

88 changes: 88 additions & 0 deletions src/CG/PlatformBundle/Resources/public/js/load_konamis.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
$(document).ready(function() {

//Sound initialization
ion.sound({
sounds: [
{name: "helicopter"}
],
path: "../sounds/",
preload: true,
volume: 1.0
});



/**
* Sets the image background of the div
**/
var setImage = function(_imageName) {
$("#overlay").css("background", "url(../img/"+ _imageName + ")");
$("#overlay").css("background-repeat", "no-repeat");

//resize object according to document size
var object_width = $( document ).width();
var object_height = $( document ).height();
object_width = object_width.toString() + "px";
object_height = object_height.toString() + "px";
$("#overlay").css("width", object_width);
$("#overlay").css("height", object_height);

$("#overlay").css("background-size", "100%");
}

/**
* Displays the overlay panel
**/
var displayOverlay = function() {
$("#overlay").show();
}

var hideOverlay = function() {
$('#overlay').addClass('animated fadeOutLeft');
//$("#overlay").hide();
}

var startAnimation = function(_animation) {
$('#overlay').addClass('animated ' + _animation);
}



if ( window.addEventListener )
{
var kkeys = [], konami = ["caae34a5e81031268bcdaf6f1d8c04d37b7f2c349afb705b575966f63e2ebf0fd910c3b05160ba087ab7af35d40b7c719c53cd8b947c96111f64105fd45cc1b2","caae34a5e81031268bcdaf6f1d8c04d37b7f2c349afb705b575966f63e2ebf0fd910c3b05160ba087ab7af35d40b7c719c53cd8b947c96111f64105fd45cc1b2"];
window.addEventListener("keydown", function(e){
var length = kkeys.length;
var strKeyCode = e.keyCode.toString();
var shaObj = new jsSHA(strKeyCode, "TEXT");
var hash = shaObj.getHash("SHA-512", "HEX");

//alert(strKeyCode);
if (konami[length] == hash )
{
kkeys.push(hash);
length++;
}
else
{
kkeys = [];
}

if (length == konami.length)
{
ion.sound.play("helicopter");
setImage("helico.png");
displayOverlay();
startAnimation('fadeInRight');
$('#overlay').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend',
function(){
$('#overlay').addClass('animated fadeOutLeft');

});

kkeys = [];
}
},
true);
}
});
Loading

0 comments on commit e10f4c8

Please sign in to comment.