summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2016-05-10 15:58:52 -0400
committerJules Laplace <jules@okfoc.us>2016-05-10 15:58:52 -0400
commit17f2644e3d885c8aef170023c84933e5bd888402 (patch)
tree38502ca528d14605f202e49b22ec6dedf1580d34
parent130a69fbfdf83c1e47344942b35abc094778109e (diff)
more convenient canvas.get syntax..
-rw-r--r--doc/shaders/util.txt13
-rw-r--r--index.html9
-rw-r--r--js/matrix.js7
-rw-r--r--js/ui/controls.js2
4 files changed, 26 insertions, 5 deletions
diff --git a/doc/shaders/util.txt b/doc/shaders/util.txt
index d192652..a455eb3 100644
--- a/doc/shaders/util.txt
+++ b/doc/shaders/util.txt
@@ -23,3 +23,16 @@ Tip: Set to "animate brush", then use option+shift (alt+shift) to
copy color from the canvas. Brush will have the "shape" of the
copied color only. Can be a cool effect when used with fg/bg only.
+
+
+>> copy color from canvas at x/y
+
+lex.assign( canvas.get(x,y) )
+
+
+
+>> animate canvas up and to the left..
+
+lex.assign( canvas.get(x+1,y+1) )
+
+
diff --git a/index.html b/index.html
index ee9b646..0f0f10d 100644
--- a/index.html
+++ b/index.html
@@ -91,10 +91,11 @@
</body>
<script type="text/javascript-shader" id="demo_shader">
- lex.bg = hue((x+y*y+t/10)/20)
- lex.fg = colors.white
- lex.char = " "
- // lex.opacity = 1
+// lex.bg = hue((x+y*y+t/10)/20)
+// lex.fg = colors.white
+// lex.char = " "
+// lex.opacity = 1
+
</script>
<script src="js/vendor/colorcode.js"></script>
<script src="js/vendor/text-encoder-lite.js"></script>
diff --git a/js/matrix.js b/js/matrix.js
index 275e6b6..de59e17 100644
--- a/js/matrix.js
+++ b/js/matrix.js
@@ -151,6 +151,13 @@ Matrix.prototype.getCell = function(x,y){
if (this.aa[y] && this.aa[y][x]) return this.aa[y][x]
else return null
}
+Matrix.prototype.get = function(x,y){
+ y = floor(mod(y || 0, this.h))
+ x = floor(mod(x || 0, this.w))
+ if (this.aa[y] && this.aa[y][x]) return this.aa[y][x]
+ else return null
+}
+
Matrix.prototype.resize = function(w,h){
w = w || canvas.w
h = h || canvas.h
diff --git a/js/ui/controls.js b/js/ui/controls.js
index c191cc2..9139989 100644
--- a/js/ui/controls.js
+++ b/js/ui/controls.js
@@ -37,6 +37,7 @@ var controls = (function(){
controls.text = new Tool (text_el)
controls.text.use = function(){
+ current_filetool && current_filetool.blur()
}
controls.select = new Tool (select_el)
@@ -111,7 +112,6 @@ var controls = (function(){
if (! selection.hidden) selection.reposition()
this.update( state )
}
-
ClipboardTool = FileTool.extend({
blur: function(){
this.__blur()