summaryrefslogtreecommitdiff
path: root/colors.html
diff options
context:
space:
mode:
authorJulie Lala <jules@okfoc.us>2014-12-02 02:05:45 -0500
committerJulie Lala <jules@okfoc.us>2014-12-02 02:05:45 -0500
commit9ff87fbff2f89ab64f22d30b35bfb691d8e513de (patch)
tree7e8fb5ec5689bdcf92c3f2c340db38b540d312c8 /colors.html
parent8d26b2871b711d18e042a7f14d1b7e9a253dee74 (diff)
add alt color cycle
Diffstat (limited to 'colors.html')
-rw-r--r--colors.html92
1 files changed, 92 insertions, 0 deletions
diff --git a/colors.html b/colors.html
new file mode 100644
index 0000000..f5f9381
--- /dev/null
+++ b/colors.html
@@ -0,0 +1,92 @@
+<link rel="stylesheet" href="css/sally.css" type="text/css" charset="utf-8" />
+<link rel="stylesheet" href="css/ak.css" type="text/css" charset="utf-8" />
+
+<body class="loading">
+<center>
+
+<div id="canvas_rapper" style="margin: 0 auto;margin-top:7%">
+</div>
+
+</body>
+<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
+<script src="js/util.js"></script>
+<script src="js/color.js"></script>
+<script src="js/lex.js"></script>
+<script src="js/matrix.js"></script>
+<script>
+
+// var color_hue_order = ("black dark-blue purple dark-red red orange " +
+// "yellow lime green dark-cyan cyan blue magenta dark-gray light-gray white").split(" ");
+
+var color_mat_order = ("dark-red red orange yellow lime cyan dark-cyan blue dark-blue purple magenta dark-red black").split(" ")
+
+function color_mat (i) { return colors[color_mat_order[ mod(i,color_mat_order.length) ]] }
+
+function lerp_color (lex, start_color, end_color, t, x, y) {
+ if (t < 0.2) {
+ lex.bg = start_color
+ }
+ else if (t < 0.4) {
+ lex.bg = start_color
+ lex.fg = end_color
+ lex.char = (x+y) % 2 ? " " : "x"
+ }
+ else if (t < 0.6) {
+ lex.bg = start_color
+ lex.fg = end_color
+ lex.char = "x"
+ }
+ else if (t < 0.8) {
+ if ((x+y) % 2) {
+ lex.bg = end_color
+ lex.fg = start_color
+ }
+ else {
+ lex.bg = start_color
+ lex.fg = end_color
+ }
+ lex.char = "x"
+ }
+ else if (t < 5.0) {
+ lex.bg = end_color
+ lex.fg = start_color
+ lex.char = (x+y) % 2 ? " " : "x"
+ }
+ else {
+ lex.bg = end_color
+ }
+}
+
+
+var grid_w = 6, grid_h = 4, across = 12
+//var grid_w = 3, grid_h = 3, across = 24
+var canvas = new Matrix (72, 35, function(x,y){
+ var lex = new Lex (x,y)
+
+ var i = floor(x / grid_w) + floor(y / grid_h) * across
+ var hue = floor(i / 5)
+ var t = (i % 5) / 5
+
+ var xx = x % grid_w
+ var yy = y % grid_h
+
+ if (hue < 5*color_mat_order.length-1) {
+ var start_color = color_mat(hue)
+ var end_color = color_mat(hue+1)
+ }
+ else {
+ var start_color = gray(hue)
+ var end_color = gray(hue+1)
+ }
+
+ if (xx != grid_w-1 && yy != grid_h-1) {
+ lerp_color(lex, start_color, end_color, t, xx, yy)
+ }
+
+ lex.build()
+ return lex
+})
+canvas.append(canvas_rapper)
+
+document.body.className = ""
+</script> \ No newline at end of file