Created
December 25, 2016 06:24
-
-
Save gamehelp16/137a1affd25c6a275a75da110055ffbb to your computer and use it in GitHub Desktop.
A little script to paste into https://isitchristmas.com/ to create some cool effects. Preview: http://i.imgur.com/0TJZmmf.gif
This file contains 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 count = 0; | |
var count2 = 0; | |
var auto = setInterval(function() { | |
var centerX = 300; | |
var centerY = 300; | |
var asd = Math.round(count * 10) / 180 * Math.PI; | |
var radius = 125 + Math.cos(asd) * 25; // wave | |
var radius2 = 0; // flag | |
var radius3 = 75 + Math.cos(asd) * 25; // ghost | |
var angle = count / 180 * Math.PI; | |
var angle2 = count2 / 180 * Math.PI; | |
var x = centerX + radius * Math.cos(count); | |
var y = centerY + radius * Math.sin(count); | |
var x2 = centerX + radius2 * Math.cos(count2); | |
var y2 = centerY + radius2 * Math.sin(count2); | |
var x3 = centerX + radius3 * Math.cos(count); | |
var y3 = centerY + radius3 * Math.sin(count); | |
var dx = x - centerX; | |
var dy = y - centerY; | |
//var dx2 = x2 - centerX; | |
//var dy2 = y2 - centerY; | |
var dx3 = x3 - centerX; | |
var dy3 = y3 - centerY; | |
var rotation = Math.atan2(dx, dy) / Math.PI * 180; | |
//var rotation2 = Math.atan2(dy2, dx2); | |
var rotation3 = Math.atan2(dy3, dx3); | |
IIC.setAngle(rotation); | |
IIC.makeWave(x, y); | |
//IIC.setAngle(rotation2); | |
IIC.setPosition(centerX, centerY); | |
if(Math.round(count * 10) % 3 == 0) { | |
IIC.setAngle(rotation3); | |
IIC.makeGhost(x3, y3); | |
} | |
count += .1; | |
count2 -= .1; | |
}, 50); |
This file contains 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
clearInterval(auto); count = 0; count2 = 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment