Last active
August 29, 2015 14:12
-
-
Save Plazmaz/8389e60d99991284c8be to your computer and use it in GitHub Desktop.
script for http:/isitchristmas.com. this script makes spirals around everyone and turns you into a troll face.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var radius = 2; | |
var i = 0; | |
var idx = 0; | |
var increment = 5; | |
var icon = "../emojis/trollface" | |
IIC.setCountry(icon); | |
document.onmousemove = move; | |
var loop = setInterval(function() { | |
for (var id in others) { | |
//console.log(id) | |
if(others[id].flag == undefined ) | |
continue; | |
var left = others[id].flag.style.left; | |
var top = others[id].flag.style.top; | |
var origX = left.substring(0, left.indexOf("px")); | |
var origY = top.substring(0, top.indexOf("px")); | |
//console.log(origX + ", " + origY) | |
var origRot = IIC.getAngle(); | |
i++; | |
if(i % 100 == 0) { | |
radius += increment; | |
} | |
if(radius >= 100 || radius <= 1) { | |
increment = -increment; | |
radius += increment; | |
} | |
//var radius = i / 5000; | |
//the numbers at the beginning can be changed to whatever | |
var x = 1010 + (Math.cos(i) * radius); | |
var y = 300 + (Math.sin(i) * radius); | |
IIC.setPosition(x, y) | |
IIC.setAngle(i); | |
IIC.makeWave(x, y); | |
//IIC.makeGhost(origX, origY); | |
IIC.setPosition(origX, origY) | |
IIC.setAngle(0); | |
IIC.makeGhost(997, 275); | |
IIC.setAngle(origRot); | |
} | |
}, 5); | |
function move(e) { | |
IIC.makeWave(e.pageX, e.pageY); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment