Académique Documents
Professionnel Documents
Culture Documents
DOCTYPE html>
<html>
<head>
<title>You See - 3D photo Early</title>
<link href='http://silverhillshss.org/forum//extensions/Smile/tango/face-devil-g
rin.png' rel='shortcut icon'/>
<style type="text/css">
html {
overflow: hidden;
}
body {
position: absolute;
margin: 0px;
padding: 0px;
background: #000;
width: 100%;
height: 100%;
}
#screen {
position: absolute;
width: 100%;
height: 100%;
background: #000;
overflow: hidden;
font-family: Segoe UI, Verdana, Arial, Sans-Serif;
color: #fff;
}
#screen canvas {
position: absolute;
width: 100%;
height: 100%;
background:#000 url(http://www.putracyber4rt.us.tc/images/backgr
ound3.gif) repeat;
background-attachment:fixed;
position: absolute;
}
</style>
<!-- ge1doot libraries -->
<script type="text/javascript" src="http://www.dhteumeuleu.com/dhtml/library/scr
eenEventsHandler.js"></script>
<script type="text/javascript" src="http://www.dhteumeuleu.com/dhtml/library/Eas
ingInOut.js"></script>
<script type="text/javascript" src="http://www.dhteumeuleu.com/dhtml/library/tex
tureMapping.js"></script>
<script type="text/javascript">
// =============================================================
//
===== CANVAS 3D experiment =====
// script written by Gerard Ferrandez - February 14, 2012
// http://www.dhteumeuleu.com/
// =============================================================
"use strict";
(function () {
// ======== private vars ========
var faces = [];
var scr, target, targetold, faceOver;
var globalRX = 0, globalRY = 0;
return {
x: x * Math.cos(ay) - z * Math.sin(ay),
y: ty,
z: tz * Math.cos(ax) - y * Math.sin(ax)
}
};
// ---- quad points ---this.p0 = new Point(this, [f.x, f.y, f.z], transform(-w, -h, 0,
ax, ay));
this.p1 = new Point(this, [f.x, f.y, f.z], transform( w, -h, 0,
ax, ay));
this.p2 = new Point(this, [f.x, f.y, f.z], transform( w, h, 0,
ax, ay));
this.p3 = new Point(this, [f.x, f.y, f.z], transform(-w, h, 0,
ax, ay));
// ---- corner points ---this.c0 = new Point(false, [f.x, f.y, f.z], transform(-w, -h, -1
5, ax, ay));
this.c1 = new Point(false, [f.x, f.y, f.z], transform( w, -h, -1
5, ax, ay));
this.c2 = new Point(false, [f.x, f.y, f.z], transform( w, h, -1
5, ax, ay));
this.c3 = new Point(false, [f.x, f.y, f.z], transform(-w, h, -1
5, ax, ay));
// ---- target angle ---var r = transform(ax, ay, 0, ax, ay, 0);
this.ax = r.x + Math.PI / 2;
this.ay = r.y + Math.PI / 2;
// ---- create 3D image ---this.img = new ge1doot.textureMapping.Image(scr.canvas, path + f
.src, f.tl || 2);
};
// ======== face projection ========
Face.prototype.projection = function () {
this.visible = true;
this.distance = -99999;
// ---- points projection ---this.p0.projection();
this.p1.projection();
this.p2.projection();
this.p3.projection();
// ---- back face culling ---if (!(
((this.p1.Y - this.p0.Y) / (this.p1.X - this.p0.X) (this.p2.Y - this.p0.Y) / (this.p2.X - this.p0.X) < 0) ^
(this.p0.X <= this.p1.X == this.p0.X > this.p2.X)
) || this.hidden) {
this.visible = false;
this.distance = -99999;
if (!this.locked && this.hidden === false) this.hidden =
true;
}
};
// ======== face border ========
Face.prototype.border = function () {
this.c0.projection();
this.c1.projection();
this.c2.projection();
this.c3.projection();
this.pc.projection();
scr.ctx.beginPath();
scr.ctx.moveTo(this.c0.X, this.c0.Y);
scr.ctx.lineTo(this.c1.X, this.c1.Y);
scr.ctx.lineTo(this.c2.X, this.c2.Y);
scr.ctx.lineTo(this.c3.X, this.c3.Y);
scr.ctx.closePath();
scr.ctx.strokeStyle = "rgb(255,255,255)";
scr.ctx.lineWidth = this.pc.scale * this.f.w / 30;
scr.ctx.lineJoin = "round";
scr.ctx.stroke();
};
// ======== update pointer style (PC) ========
var pointer = function () {
// ---- on mouse over ---target = false;
var i = 0, f;
while ( f = faces[i++] ) {
if (f.visible) {
if (
f.img.pointerInside(
scr.mouseX,
scr.mouseY,
f.p0, f.p1, f.p2, f.p3
)
) target = f;
} else break;
}
if (target && target.f.select != false && !scr.drag) {
faceOver = target;
scr.container.style.cursor = "pointer";
} else scr.container.style.cursor = "move";
};
// ======== onclick ========
var click = function () {
pointer();
// ---- target image ---if (target && target.f.select != false) {
if (target == targetold) {
// ---- reset scene ---camera.center();
targetold = false;
} else {
targetold = target;
target.locked = false;
// ---- target redirection ---if (target.f.target != "") {
var i = 0, f;
while ( f = faces[i++] ) {
if (f.f.id && f.f.id == target.f
.target) {
target = f;
targetold = f;
if (f.hidden) {
f.hidden = false
;
f.locked = true;
targetold = fals
e;
}
break;
}
}
}
// ---- move camera ---target.pc.projection();
camera.setTarget(target);
}
}
};
////////////////////////////////////////////////////////////////////////
////
var init = function (json) {
// ---- init script ---scr = new ge1doot.screen.InitEvents({
container: "screen",
canvas: "canvas",
click: click,
move: pointer
});
// ---- create faces ---var i = 0, f;
while ( f = json.faces[i++] ) {
faces.push(
new Face(json.path, f)
);
}
// ---- engine start ---run();
};
////////////////////////////////////////////////////////////////////////
////
// ===== main loop =====
var run = function () {
// ---- clear screen ---scr.ctx.clearRect(0,0, scr.width, scr.height);
// ---- 3D projection ---var i = 0, f;
while ( f = faces[i++] ) {
f.projection();
}
// ---- faces depth sorting ---faces.sort(function (p0, p1) {
return p1.distance - p0.distance;
});
// ---- drawing ---var i = 0, f;
while ( f = faces[i++] ) {
if (f.visible) {
// ---- draw image ---f.img.draw3D(f.p0, f.p1, f.p2, f.p3);
if (f.locked && scr.drag) f.locked = false;
if (f === faceOver) faceOver.border();
} else break;
}
// ---- camera ---camera.move();
// ---- loop ---setTimeout(run, 16);
}
return {
////////////////////////////////////////////////////////////////
////////////
// ---- onload event ---load : function (json) {
window.addEventListener('load', function () {
setTimeout(function () {
init(json);
}, 500);
}, false);
}
}
})().load({
path: "",
faces: [
// ---- main images ---{id: "1", src:"http://upl0ad.co.cc/upload/love_in_the_middle_of_
good_vs_evil_by_sammi723-d4rg04l.jpg",
x:0,
y:0,
z:200, rx:0, ry:0,
w: 300, h: 200, select: false},
{id: "2", src:"http://upl0ad.co.cc/upload/early%20logo.png", x:
200, y:0,
z:0,
rx:0, ry:-1, w: 300, h: 200},
{id: "3", src:"http://upl0ad.co.cc/upload/3rd%20early%20logo.png
", x:0,
y:150, z:0,
rx:1, ry:0, w: 300, h: 200},
{id: "4", src:"http://upl0ad.co.cc/upload/2nd%20early%20logo.png
", x:0,
y:-150, z:0,
rx:-1, ry:0, w: 300, h: 200},
{id: "5", src:"http://a2.sphotos.ak.fbcdn.net/hphotos-ak-snc7/39
4531_358520104163604_100000168514753_1696993_2014238464_n.jpg", x:-200, y:0,
z:0,
rx:0, ry:1, w: 300, h: 200},
{id: "6", src:"http://a1.sphotos.ak.fbcdn.net/hphotos-ak-ash4/38
8706_341181855897429_100000168514753_1631988_465404207_n.jpg", x:0,
y:0,
z
:-200, rx:0, ry:-2, w: 300, h: 200},
// ---- special hidden image :) ---{id: "7", target: "1", src:"http://upl0ad.co.cc/upload/2nd%20ear
ly%20logo.png", x:0, y:0, z:200, rx:0, ry:-2, w: 300, h: 200, hidden: true},
// ---- small targets ---{src:"http://upl0ad.co.cc/upload/love_in_the_middle_of_good_vs_e
vil_by_sammi723-d4rg04l.jpg", target: "6", x:0,
y:-40, z:170, rx:0, ry:0, w:
80, h: 60, tl: 1},
{src:"http://upl0ad.co.cc/upload/early%20logo.png", target: "5",
x:-100, y:-40, z:170, rx:0, ry:0, w: 80, h: 60, tl: 1},
{src:"http://upl0ad.co.cc/upload/3rd%20early%20logo.png", targe
t: "4", x:100, y:-40, z:170, rx:0, ry:0, w: 80, h: 60, tl: 1},
{src:"http://a7.sphotos.ak.fbcdn.net/hphotos-ak-snc7/407897_3766
35722352042_100000168514753_1756271_1563649639_n.jpg", target: "3", x:0,
y:4
0, z:170, rx:0, ry:0, w: 80, h: 60, tl: 1},
{src:"http://a8.sphotos.ak.fbcdn.net/hphotos-ak-snc7/s720x720/40
0256_384551034893844_100000168514753_1778025_1784255601_n.jpg", target: "2", x:
-100, y:40, z:170, rx:0, ry:0, w: 80, h: 60, tl: 1},
{src:"http://a6.sphotos.ak.fbcdn.net/hphotos-ak-ash4/s720x720/32
1227_320282721320676_100000168514753_1570464_1075191984_n.jpg",
target: "7",
x:100, y:40, z:170, rx:0, ry:0, w: 80, h: 60, tl: 1}
]
});
</script>
</head>
<body>
<div id="screen">