summaryrefslogtreecommitdiff
path: root/update-component.js
diff options
context:
space:
mode:
Diffstat (limited to 'update-component.js')
-rw-r--r--update-component.js463
1 files changed, 463 insertions, 0 deletions
diff --git a/update-component.js b/update-component.js
new file mode 100644
index 0000000..2fd4819
--- /dev/null
+++ b/update-component.js
@@ -0,0 +1,463 @@
+events = {}
+events[5 * FPS] = function(){
+ messages.unshift({
+ type: 1,
+ text: "l0st"
+ })
+}
+events[8 * FPS] = function(){
+ messages.unshift({
+ type: 2,
+ from: "l0st",
+ text: "hi...",
+ pixels: []
+ })
+}
+normalUpdate = {
+ update: function(){
+ if(t in events){
+ events[t]()
+ }
+ t++
+ if(currentMessagePixels.length >= smile.length){
+ currentMessagePixels = currentMessagePixels.slice(0, smile.length)
+ transform(currentMessagePixels, smile, 100)
+ }
+ }
+}
+function transform(fromPixels, toPixels, period){
+ for(var i = 0 ; i < toPixels.length; i++){
+ var actualDX = toPixels[i].x - fromPixels[i].x;
+ var actualDY = toPixels[i].y - fromPixels[i].y;
+ var dX = Math.sign(actualDX) * Math.min(1, Math.abs(actualDX))
+ var dY = Math.sign(actualDY) * Math.min(1, Math.abs(actualDY))
+ fromPixels[i].x += dX
+ fromPixels[i].y += dY
+ }
+}
+var smile = [
+ {
+ "x": 117,
+ "y": -62.5
+ },
+ {
+ "x": 116,
+ "y": -63
+ },
+ {
+ "x": 116,
+ "y": -62
+ },
+ {
+ "x": 115,
+ "y": -62
+ },
+ {
+ "x": 114,
+ "y": -61
+ },
+ {
+ "x": 114,
+ "y": -61
+ },
+ {
+ "x": 115,
+ "y": -61
+ },
+ {
+ "x": 115,
+ "y": -61
+ },
+ {
+ "x": 115,
+ "y": -61
+ },
+ {
+ "x": 116,
+ "y": -61
+ },
+ {
+ "x": 116,
+ "y": -60
+ },
+ {
+ "x": 116,
+ "y": -60
+ },
+ {
+ "x": 116,
+ "y": -60
+ },
+ {
+ "x": 116,
+ "y": -60
+ },
+ {
+ "x": 116,
+ "y": -60
+ },
+ {
+ "x": 116,
+ "y": -60
+ },
+ {
+ "x": 117,
+ "y": -60
+ },
+ {
+ "x": 117,
+ "y": -60
+ },
+ {
+ "x": 117,
+ "y": -61
+ },
+ {
+ "x": 142.5,
+ "y": -62
+ },
+ {
+ "x": 142,
+ "y": -62
+ },
+ {
+ "x": 142,
+ "y": -62
+ },
+ {
+ "x": 142,
+ "y": -62
+ },
+ {
+ "x": 142,
+ "y": -62
+ },
+ {
+ "x": 142,
+ "y": -61
+ },
+ {
+ "x": 142,
+ "y": -61
+ },
+ {
+ "x": 142,
+ "y": -61
+ },
+ {
+ "x": 142,
+ "y": -61
+ },
+ {
+ "x": 143,
+ "y": -61
+ },
+ {
+ "x": 143,
+ "y": -61
+ },
+ {
+ "x": 143,
+ "y": -61
+ },
+ {
+ "x": 144,
+ "y": -61
+ },
+ {
+ "x": 144,
+ "y": -62
+ },
+ {
+ "x": 144,
+ "y": -62
+ },
+ {
+ "x": 144,
+ "y": -62
+ },
+ {
+ "x": 143,
+ "y": -62
+ },
+ {
+ "x": 143,
+ "y": -62
+ },
+ {
+ "x": 143,
+ "y": -62
+ },
+ {
+ "x": 142,
+ "y": -61
+ },
+ {
+ "x": 142,
+ "y": -60
+ },
+ {
+ "x": 142,
+ "y": -59
+ },
+ {
+ "x": 142,
+ "y": -59
+ },
+ {
+ "x": 142,
+ "y": -59
+ },
+ {
+ "x": 143,
+ "y": -59
+ },
+ {
+ "x": 143,
+ "y": -59
+ },
+ {
+ "x": 144,
+ "y": -59
+ },
+ {
+ "x": 144,
+ "y": -59
+ },
+ {
+ "x": 145,
+ "y": -59
+ },
+ {
+ "x": 145,
+ "y": -59
+ },
+ {
+ "x": 145,
+ "y": -60
+ },
+ {
+ "x": 145,
+ "y": -60
+ },
+ {
+ "x": 145,
+ "y": -60
+ },
+ {
+ "x": 144,
+ "y": -60
+ },
+ {
+ "x": 114,
+ "y": -35.5
+ },
+ {
+ "x": 114,
+ "y": -36
+ },
+ {
+ "x": 114,
+ "y": -36
+ },
+ {
+ "x": 114,
+ "y": -35
+ },
+ {
+ "x": 114,
+ "y": -35
+ },
+ {
+ "x": 114,
+ "y": -34
+ },
+ {
+ "x": 114,
+ "y": -33
+ },
+ {
+ "x": 114,
+ "y": -33
+ },
+ {
+ "x": 114,
+ "y": -32
+ },
+ {
+ "x": 115,
+ "y": -32
+ },
+ {
+ "x": 117,
+ "y": -31
+ },
+ {
+ "x": 119,
+ "y": -30
+ },
+ {
+ "x": 120,
+ "y": -29
+ },
+ {
+ "x": 121,
+ "y": -28
+ },
+ {
+ "x": 122,
+ "y": -27
+ },
+ {
+ "x": 123,
+ "y": -26
+ },
+ {
+ "x": 125,
+ "y": -26
+ },
+ {
+ "x": 126,
+ "y": -25
+ },
+ {
+ "x": 127,
+ "y": -25
+ },
+ {
+ "x": 128,
+ "y": -24
+ },
+ {
+ "x": 129,
+ "y": -24
+ },
+ {
+ "x": 130,
+ "y": -24
+ },
+ {
+ "x": 131,
+ "y": -24
+ },
+ {
+ "x": 131,
+ "y": -24
+ },
+ {
+ "x": 132,
+ "y": -24
+ },
+ {
+ "x": 133,
+ "y": -24
+ },
+ {
+ "x": 134,
+ "y": -24
+ },
+ {
+ "x": 135,
+ "y": -24
+ },
+ {
+ "x": 136,
+ "y": -24
+ },
+ {
+ "x": 138,
+ "y": -25
+ },
+ {
+ "x": 139,
+ "y": -25
+ },
+ {
+ "x": 140,
+ "y": -26
+ },
+ {
+ "x": 141,
+ "y": -27
+ },
+ {
+ "x": 142,
+ "y": -27
+ },
+ {
+ "x": 143,
+ "y": -28
+ },
+ {
+ "x": 143,
+ "y": -29
+ },
+ {
+ "x": 144,
+ "y": -30
+ },
+ {
+ "x": 145,
+ "y": -30
+ },
+ {
+ "x": 145,
+ "y": -31
+ },
+ {
+ "x": 146,
+ "y": -32
+ },
+ {
+ "x": 146,
+ "y": -32
+ },
+ {
+ "x": 147,
+ "y": -33
+ },
+ {
+ "x": 147,
+ "y": -33
+ },
+ {
+ "x": 148,
+ "y": -34
+ },
+ {
+ "x": 148,
+ "y": -35
+ },
+ {
+ "x": 148,
+ "y": -35
+ },
+ {
+ "x": 148,
+ "y": -36
+ },
+ {
+ "x": 149,
+ "y": -36
+ },
+ {
+ "x": 149,
+ "y": -37
+ },
+ {
+ "x": 149,
+ "y": -37
+ },
+ {
+ "x": 149,
+ "y": -38
+ },
+ {
+ "x": 149,
+ "y": -38
+ },
+ {
+ "x": 149,
+ "y": -39
+ }
+ ] \ No newline at end of file