var interval2, cursorInter = -1, nbimg = 1, m3D = function () { var f = [], c, m, b, d, a = { x: 0, y: 0, z: -650, s: 0, fov: 500 }, n = 0, o = 0; a.setTarget = function (c, e, b) { if (Math.abs(e - c) > 0.1 && (a.s = 1, a.p = 0, a.d = e - c, b)) a.d *= 2, a.p = 9 }; a.tween = function (c) { if (a.s != 0) if (a.p += a.s, a[c] += a.d * a.p / 100, a.p == 10) a.s = -1; else if (a.p == 0) a.s = 0; return a.s }; var k = function (i, e, h, d, f) { if (e) { this.url = e.url; this.title = e.title; this.color = e.color; this.isLoaded = !1; document.createElement("canvas").getContext ? (this.srcImg = new Image, this.srcImg.src = "build/client/images/3d/" + e.src, this.img = document.createElement("canvas"), this.canvas = !0) : (this.img = document.createElement("img"), this.img.src = "build/client/images/3d/" + e.src); c.appendChild(this.img); $(this.img).bind("click", function () { if (!a.s) { if (this.diapo.isLoaded) if (this.diapo.urlActive) top.location.href = this.diapo.url; else { a.tz = this.diapo.z - a.fov; a.tx = this.diapo.x; a.ty = this.diapo.y; if (b) b.but.className = "button viewed", b.img.className = "", b.img.style.cursor = "pointer", b.urlActive = !1; this.diapo.but.className = "button selected"; j(!1); b = this.diapo } cursorInter = i; timeIndice = 0 } }); this.but = document.createElement("div"); this.but.className = "button"; this.but.innerHTML = i + 1; m.appendChild(this.but); this.but.diapo = this; this.but.style.left = Math.round(this.but.offsetWidth * 1.2 * (i % 4)) + "px"; this.but.style.top = Math.round(this.but.offsetHeight * 1.2 * Math.floor(i / 4)) + "px"; var g = this.img; $(this.but).bind("click", function () { $(g).trigger("click") }); this.img.diapo = this; this.zi = 25E3 } else this.img = document.createElement("div"), this.isLoaded = !0, this.img.className = "fog", c.appendChild(this.img), this.h = this.w = 300, this.zi = 15E3; this.x = h; this.y = d; this.z = f; this.css = this.img.style }; k.prototype.anim = function () { if (this.isLoaded) { var c = this.x - a.x, e = this.y - a.y, b = this.z - a.z; b < 20 && (b += 5E3); var d = a.fov / b, f = this.w * d, g = this.h * d; this.css.left = Math.round(n + c * d - f * 0.5) + "px"; this.css.top = Math.round(o + e * d - g * 0.5) + "px"; this.css.width = Math.round(f) + "px"; this.css.height = Math.round(g) + "px"; this.css.zIndex = this.zi - Math.round(b) } else this.isLoaded = this.loading() }; k.prototype.loading = function () { if (this.canvas && this.srcImg.complete || this.img.complete) return this.canvas ? (this.w = this.srcImg.width, this.h = this.srcImg.height, this.img.width = this.w, this.img.height = this.h, this.img.getContext("2d").drawImage(this.srcImg, 0, 0, this.w, this.h)) : (this.w = this.img.width, this.h = this.img.height), this.but.className += " loaded", !0; return !1 }; var j = function (a) { for (var c = 0, b; b = f[c++]; ) if (b.but) b.css.msInterpolationMode = a ? "bicubic" : "nearest-neighbor", b.css.imageRendering = a ? "optimizeQuality" : "optimizeSpeed" }, p = function () { if (a.tx) { if (a.s || a.setTarget(a.x, a.tx), a.tween("x"), !a.s) a.tx = 0 } else if (a.ty) { if (a.s || a.setTarget(a.y, a.ty), a.tween("y"), !a.s) a.ty = 0 } else if (a.tz && (a.s || a.setTarget(a.z, a.tz), a.tween("z"), !a.s)) a.tz = 0, j(!0), b.url ? (b.img.style.cursor = "pointer", b.urlActive = !0, b.img.className = "href", d.diapo = b, d.onclick = b.img.onclick, d.style.visibility = "visible", d.style.color = b.color || "#fff", d.style.top = Math.round(b.img.offsetTop + b.img.offsetHeight - d.offsetHeight - 5) + "px", d.style.left = Math.round(b.img.offsetLeft + b.img.offsetWidth - d.offsetWidth - 5) + "px") : b.img.style.cursor = "default"; for (var c = 0, e; e = f[c++]; ) e.anim(); setTimeout(p, 32) }; return { init: function (a) { c = document.getElementById("screen"); m = document.getElementById("bar"); d = document.getElementById("urlInfo"); n = c.offsetWidth * 0.5; o = c.offsetHeight * 0.5; for (var b = 0, h, j = a.length; h = a[b++]; ) { var l = 1E3 * (b % 4 - 1.5), g = Math.round(Math.random() * 4E3) - 2E3, q = b * (5E3 / j); f.push(new k(b - 1, h, l, g, q)); nbimg++; h = f.length - 1; for (var r = 0; r < 3; r++) l = Math.round(Math.random() * 4E3) - 2E3, g = Math.round(Math.random() * 4E3) - 2E3, f.push(new k(h, null, l, g, q + 100)) } p() } } } (), timeIndice = 6, Pause = !0, screenMess = !0; function Start() { Pause || (timeIndice < 16 ? timeIndice++ : Pause || (cursorInter = (cursorInter + 1) % nbimg, cursorInter == nbimg - 1 ? ($("#GeneralTitle3D").animate({ left: "0", top: "0" }, 800), screenMess = !0, timeIndice = 6) : (screenMess && ($("#GeneralTitle3D").animate({ left: "-800px", top: "-800px" }, 800), screenMess = !1), $("#bar").find("div:eq(" + cursorInter + ")").trigger("click"))), Pause || setTimeout(function () { Start() }, 500)) } var boucle = 0, EndBoucle; $(document).ready(function () { if (!$("#screen").length || $("#screen").length > 0 && detectMobile()) { if ($("#scrollInfo").length != 0) $("#screen").remove(), EndBoucle = $($("#pub").children()).length, $("#pub").parent("div").css("width", "260px"), $("#pub a").css("position", "absolute"), $("#pub a").hide(), $($("#pub").children("a")[boucle]).show(), $("#animation").show(), annimeHome() } else $("#animation").remove() }); function annimeHome() { $($("#pub").children("a")[boucle]).fadeOut("slow"); boucle = (boucle + 1) % EndBoucle; setTimeout(function () { $($("#pub").children("a")[boucle]).fadeIn("slow") }, 100); setTimeout("annimeHome()", 7E3) } $(function () { function f() { $("#PlayStopPause").fadeTo(500, 0.5); $("#PlayStopPause").fadeTo(500, 1); setTimeout(function () { f() }, 1100) } $("#screen").length > 0 && ($("#screen").show(), f(), $("#PlayPausePause").click(function (c) { Pause = !0; $(this).hide(); $("#PlayPausePlay").show(); c.preventDefault && c.preventDefault(); c.returnValue = !1 }), $("#PlayPausePlay").click(function (c) { Pause = !1; timeIndice = 16; Start(); $(this).hide(); $("#PlayPausePause").show(); c.preventDefault && c.preventDefault(); c.returnValue = !1 }), $("#StopPlayPause").click(function (c) { Pause = !0; activeSlide = 0; $("#GeneralTitle3D").animate({ left: "0", top: "0" }, 800); screenMess = !0; timeIndice = 6; $("#PlayPausePlay").hide(); $("#PlayPausePause").show(); c.preventDefault && c.preventDefault(); c.returnValue = !1 }), $("#PlayStopPause").click(function (c) { Pause = activeSlide = !1; timeIndice = 16; $("#GeneralTitle3D").animate({ left: "-800px", top: "-800px" }, 800); cursorInter == 0 ? timeIndice = 0 : (cursorInter = -1, timeIndice = 16); Start(); c.preventDefault && c.preventDefault(); c.returnValue = !1 })) });
