Created
July 13, 2011 23:40
-
-
Save Pwootage/1081581 to your computer and use it in GitHub Desktop.
Light cycler
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
try | |
{ | |
directions[0] = directions[0]; | |
} | |
catch (exception) | |
{ | |
directions = new Array(); | |
for (i = 0; i < 16; i++) | |
{ | |
directions[i] = 1; | |
} | |
} | |
for (var i = 0; i < 16; i++) | |
{ | |
var oldVal = effect.getLightRampValue(i); | |
oldVal += directions[i] * 0.05; | |
if (oldVal > 1.0) | |
{ | |
directions[i] = -1; | |
} | |
if (oldVal <= 0.0) | |
{ | |
directions[i] = 1; | |
} | |
effect.setLightRampValue(i, oldVal); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment