pamela, adapted for 26c3. mouse control added, resize problems solved, alpha + color depth filtering, synchronisation with new and old entries, remaining from last commit

This commit is contained in:
Pieter Iserbyt
2009-12-28 19:49:04 +01:00
parent d6853b8c8f
commit 6851a984c2
9 changed files with 288 additions and 7030 deletions

View File

@@ -1,7 +1,143 @@
<?php header("Content-type: application/pdf"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Cache-Control: no-cache"); header("Pragma: no-cache"); ?> [ "00:01:e8:04:99:be",
"00:03:0d:55:e3:f6",
"00:08:2a:07:3d:0b",
"00:0d:60:77:44:b5",
"00:05:4e:40:1e:97",
"00:0c:f1:16:10:ba",
"00:0c:f1:1d:dc:70",
"00:0e:35:96:c7:ff",
"00:11:85:6a:1f:ec",
"00:1f:16:0c:ad:68",
"00:21:9b:df:52:9c", ]
"00:11:f5:22:9f:7d",
"00:13:02:0e:52:10",
"00:13:02:1d:76:1e",
"00:13:02:25:d8:bc",
"00:13:02:53:47:62",
"00:13:02:99:a7:78",
"00:13:02:a4:98:83",
"00:13:02:b8:a2:52",
"00:13:ce:72:dc:a2",
"00:13:e8:16:59:39",
"00:13:e8:a5:b5:05",
"00:14:a4:85:84:ad",
"00:15:af:2e:cd:45",
"00:15:af:67:0a:0b",
"00:15:af:8d:47:e2",
"00:15:af:d8:92:49",
"00:15:af:db:24:ac",
"00:15:af:e6:9c:13",
"00:16:01:9c:22:42",
"00:16:44:7f:8a:1b",
"00:16:6f:04:b7:ef",
"00:16:e6:3b:f5:1b",
"00:16:ea:68:52:1a",
"00:16:ea:71:fd:3c",
"00:16:ea:89:d5:84",
"00:16:ea:e5:7f:12",
"00:16:ea:e5:8c:fa",
"00:16:ea:ee:59:62",
"00:18:41:e0:46:65",
"00:18:41:e0:7e:ff",
"00:18:41:e1:06:e9",
"00:18:de:02:06:27",
"00:18:de:76:ff:1d",
"00:18:de:7e:22:a2",
"00:18:de:b2:52:96",
"00:18:de:b9:17:12",
"00:19:d2:0b:f0:24",
"00:19:d2:98:47:b9",
"00:19:d2:b3:ec:c3",
"00:19:e3:d8:13:0e",
"00:19:e3:d8:30:66",
"00:1b:77:04:74:ea",
"00:1b:77:41:ad:f5",
"00:1b:77:54:40:72",
"00:1b:9e:d5:be:60",
"00:1c:b3:01:5b:06",
"00:1c:b3:bc:b6:5b",
"00:1c:bf:02:08:10",
"00:1c:bf:2c:3f:fb",
"00:1c:bf:6e:a0:4a",
"00:1c:bf:73:ec:aa",
"00:1c:f0:14:32:fa",
"00:1d:4f:11:c6:4d",
"00:1d:4f:f9:97:b2",
"00:1d:e0:2d:9d:cd",
"00:1d:e0:4e:53:57",
"00:1d:e0:a3:4a:0b",
"00:1d:e0:b8:e6:af",
"00:1e:52:70:07:41",
"00:1e:52:74:75:c3",
"00:1e:52:86:cb:81",
"00:1e:c2:a4:da:2f",
"00:1e:c2:a7:6f:e6",
"00:1e:c2:bc:aa:ff",
"00:1e:c2:d2:40:e7",
"00:1f:1f:31:5f:b4",
"00:1f:3b:27:90:7d",
"00:1f:3b:39:7b:bf",
"00:1f:3b:5c:ed:73",
"00:1f:3b:82:79:13",
"00:1f:3b:a9:fe:b3",
"00:1f:3c:21:88:de",
"00:1f:3c:4b:60:a7",
"00:1f:3c:4e:ef:75",
"00:1f:3c:5d:a6:fd",
"00:1f:3c:98:77:7b",
"00:1f:3c:a5:2a:58",
"00:1f:f3:d9:95:d0",
"00:21:00:49:24:3e",
"00:21:5c:04:db:55",
"00:21:5c:29:5a:b5",
"00:21:5c:64:6d:f3",
"00:21:5d:94:fc:66",
"00:21:6a:13:69:52",
"00:21:6a:7f:d1:fe",
"00:21:6a:80:5f:c2",
"00:21:6b:1b:93:dc",
"00:21:85:77:b5:f4",
"00:21:e9:53:ce:dc",
"00:21:e9:e2:7f:5d",
"00:21:fe:5a:24:89",
"00:22:43:25:31:8b",
"00:22:43:3b:71:c9",
"00:22:43:4a:9e:00",
"00:22:43:4b:65:9a",
"00:22:43:53:2d:88",
"00:22:43:57:e2:ce",
"00:22:43:79:0f:b2",
"00:22:68:b7:f2:28",
"00:22:69:17:03:bd",
"00:22:69:30:8a:27",
"00:22:fa:60:08:54",
"00:22:fa:99:45:24",
"00:22:fa:cc:c8:f4",
"00:22:fb:47:f3:00",
"00:22:fb:70:62:e2",
"00:22:fb:8d:a3:00",
"00:23:12:54:63:87",
"00:23:32:34:20:15",
"00:23:4d:c4:df:57",
"00:23:6c:7e:f9:5a",
"00:23:6c:86:4f:98",
"00:23:76:08:dc:ee",
"00:23:76:0c:21:ee",
"00:23:76:1e:b3:c3",
"00:24:2b:7c:76:88",
"00:24:2b:89:63:59",
"00:24:2c:06:1e:4d",
"00:24:2c:1d:06:68",
"00:24:d2:6c:c9:95",
"00:25:00:49:9e:1d",
"00:25:00:4a:bc:77",
"00:25:00:4a:df:7b",
"00:25:00:4f:05:dc",
"00:25:00:b1:56:20",
"00:25:d3:44:a3:03",
"00:25:d3:5a:26:52",
"00:26:08:dd:13:28",
"00:26:08:e6:6e:7f",
"00:26:08:e6:87:6f",
"00:26:bb:0b:64:82",
"00:26:bb:0f:c7:ec",
"00:26:bb:1d:36:f8",
"00:26:ff:b7:39:c9",
"00:a0:f5:e0:a7:bc",
"00:bd:3a:69:69:5f",
"a4:ed:4e:b7:2d:c7", ]

View File

@@ -62,7 +62,7 @@ Node.prototype.normal = {
Math.round(128 * invAlphaScale + this.color[2] * alphaScale),
];
context.fillStyle = 'rgb(' + col[0] + ',' + col[1] + ',' + col[2] + ')';
//context.globalAlpha = this.alpha / 255;
context.globalAlpha = this.alpha / 255;
context.beginPath();
context.arc(this.projection.x, this.projection.y, scale, 0, Math.PI * 2, false);
context.fill();

144
js/pamela-nodes.js~ Normal file
View File

@@ -0,0 +1,144 @@
// Class Node
function Node(name) {
this.name = name;
this.modeTime = (new Date).getTime();
this.setMode("newNode");
var size = Math.min(width, height);
this.color = [
Math.random() * 128,
Math.random() * 128,
Math.random() * 128];
this.position = new Vector(
(Math.random() * size) - (size / 2),
(Math.random() * size) - (size / 2),
(Math.random() * size) - (size / 2));
this.position.scale(0.5);
}
Node.prototype.setMode = function(mode) {
this.modeTime = (new Date).getTime();
if (mode == "newNode") {
jQuery.extend(this, Node.prototype.newNode);
} else if (mode == "dying") {
jQuery.extend(this, Node.prototype.dying);
} else if (mode == "dead") {
jQuery.extend(this, Node.prototype.dead);
this.isDead = true;
} else {
jQuery.extend(this, Node.prototype.normal);
}
};
Node.prototype.alphaForDepth = function(d, start, cutoff) {
d = d < cutoff ? cutoff : d > start ? start : d;
return 1 - (d - start) / (cutoff - start);
};
//Normal mode
Node.prototype.normal = {
project: function(m) {
this.projection = m.project(this.position);
this.alpha = 255 * this.alphaForDepth(this.projection.z, 0, -400);
},
draw: function() {
if (this.projection.z > -1) return;
var scale = width * 3 / -this.projection.z;
var alphaScale = this.alpha / 255;
var invAlphaScale = 1 - alphaScale;
var col =
/* [
Math.round(this.color[0]),
Math.round(this.color[1]),
Math.round(this.color[2]),
]; */
[
Math.round(128 * invAlphaScale + this.color[0] * alphaScale),
Math.round(128 * invAlphaScale + this.color[1] * alphaScale),
Math.round(128 * invAlphaScale + this.color[2] * alphaScale),
];
context.fillStyle = 'rgb(' + col[0] + ',' + col[1] + ',' + col[2] + ')';
context.globalAlpha = 128 + this.alpha / 512;
context.beginPath();
context.arc(this.projection.x, this.projection.y, scale, 0, Math.PI * 2, false);
context.fill();
context.font = scale + "pt sans-serif";
context.fillText(this.name, this.projection.x + (scale * 1.5), this.projection.y + (scale / 1.5));
context.closePath();
context.globalAlpha = 1;
}
};
//New mode
Node.prototype.newNode = {
project: function(m) {
var newTime = (new Date).getTime() - this.modeTime;
if (newTime > 1000) {
this.setMode("normal");
this.project(m);
return;
}
var scale = Math.sqrt(1000 / Math.max(newTime, 1));
this.projection = m.clone().scale(scale, scale, scale).project(this.position);
this.alpha = 255 * this.alphaForDepth(this.projection.z, 0, -500);
}
};
//Dying mode
Node.prototype.dying = {
project: function(m) {
var dyingTime = (new Date).getTime() - this.modeTime;
if (dyingTime > 1000) {
this.setMode("dead");
return;
}
var scale = Math.sqrt(1000 / Math.max(1000 - dyingTime, 1));
this.projection = m.clone().scale(scale, scale, scale).project(this.position);
this.alpha = 255 * this.alphaForDepth(this.projection.z, 0, -500);
}
};
//Dead mode
Node.prototype.dead = {
project: function(m) {
},
draw: function() {
}
};
// For inheriting classes
Node.prototype.project = Node.prototype.normal.project;
Node.prototype.draw = Node.prototype.normal.draw;
// Class NorbertNode
jQuery.extend(NorbertNode.prototype, Node.prototype);
function NorbertNode() {
this.norbert = new Image();
this.norbert.src = "img/ccc.png";
this.position = new Vector(0, 0, 0);
}
NorbertNode.prototype.draw = function() {
var s = Math.abs(this.projection.z / (width / 2));
s *= 2;
//var x = Math.floor(this.projection.x - (186 / s));
//var y = Math.floor(this.projection.y - (50 / s));
var x = Math.floor(this.projection.x - (250 / s));
var y = Math.floor(this.projection.y - (180 / s));
context.drawImage(this.norbert, x, y);
};