summaryrefslogtreecommitdiff
path: root/colors2.html
diff options
context:
space:
mode:
authorJulie Lala <jules@okfoc.us>2014-12-21 01:24:54 -0500
committerJulie Lala <jules@okfoc.us>2014-12-21 01:24:54 -0500
commitfe5b9cf2386f83901a3039e470f36fb389c1c5e6 (patch)
tree2ff48020b75be5d64dbc18456f1b9c5b6ded9ca9 /colors2.html
parent4474fd92802e6873a429e2ab4502c34cbe0b09b3 (diff)
other colors
Diffstat (limited to 'colors2.html')
-rw-r--r--colors2.html100
1 files changed, 100 insertions, 0 deletions
diff --git a/colors2.html b/colors2.html
new file mode 100644
index 0000000..2f82ad1
--- /dev/null
+++ b/colors2.html
@@ -0,0 +1,100 @@
+<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) {
+ t = clamp(t, 0, 1)
+ t *= 6
+ if (t < 1.0) {
+ lex.bg = start_color
+ }
+ else if (t < 2.0) {
+ lex.bg = start_color
+ lex.fg = end_color
+ lex.char = (x+y) % 2 ? " " : "x"
+ }
+ else if (t < 3.0) {
+ lex.bg = start_color
+ lex.fg = end_color
+ lex.char = "x"
+ }
+ else if (t < 4.0) {
+ 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"
+ }
+ else if (t < 6.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 = 14, down = 9, gap = 1, dd = 100
+var width = grid_w * across, height = grid_h * down
+//var grid_w = 3, grid_h = 3, across = 24, gap = 1
+var canvas = new Matrix (width, height, function(x,y){
+ var lex = new Lex (x,y)
+
+ var i = floor(x / grid_w)
+ var j = floor(y / grid_h) * across
+ var hue = floor((i+j) / dd)
+ var t = ((i+j) / dd) % 1
+
+ var xx = x % grid_w
+ var yy = y % grid_h
+
+ if (hue < 4*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-gap && yy != grid_h-gap) {
+ 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