Permalink
Browse files

size management

  • Loading branch information...
1 parent 6c72515 commit 0b9237223282e3633e56444df44307dfab06cf82 @tholman committed Nov 16, 2016
Showing with 67 additions and 7 deletions.
  1. +12 −7 asciiMorph.js
  2. +55 −0 readme.md
View
@@ -8,10 +8,8 @@ var AsciiMorph = (function() {
'use strict';
var element = null;
- var canvasDimensions = {
- x: 51,
- y: 28
- }
+ var canvasDimensions = {};
+
var renderedData = [];
var framesToAnimate = [];
var myTimeout = null;
@@ -47,10 +45,11 @@ var AsciiMorph = (function() {
* AsciiMorph
*/
- function init(el) {
+ function init(el, canvasSize) {
// Save the element
element = el;
+ canvasDimensions = canvasSize;
}
function squareOutData(data) {
@@ -232,8 +231,14 @@ var AsciiMorph = (function() {
// framesToAnimate
}
- function main(element) {
- init(element);
+ function main(element, canvasSize) {
+
+ if( !element || !canvasSize ) {
+ console.log("sorry, I need an element and a canvas size");
+ return;
+ }
+
+ init(element, canvasSize);
}
return extend(main, {
View
@@ -0,0 +1,55 @@
+## AsciiMorph
+AsciiMorph is a small stand alone javascript library for rendering ascii art and creations into elements, allowing for them to be changed out with a morphing transition.
+
+### Demo
+Here's a gif of it in action. You can also play with the demo live here.
+
+### Usage
+
+
+var element = document.querySelectorAll('pre')[0];
+AsciiMorph(element, {x: 51,y: 28});
+
+var bird = [
+" /",
+" /",
+" /;",
+" //",
+" ;/",
+" ,//",
+" _,-' ;_,,",
+" _,'-_ ;|,'",
+" _,-'_,..--. |",
+" ___ .'-'_)' ) _)\\| ___",
+" ,'\"\"\"`'' _ ) ) _) ''--'''_,-'",
+"-={-o- /| ) _) ) ; '_,--''",
+" \\ -' ,`. ) .) _)_,''|",
+" `.\"( `------'' /",
+" `.\\ _,'",
+" `-.____....-\\\\",
+" || \\\\",
+" // ||",
+" // ||",
+" _-.//_ _||_,",
+" ,' ,-'/"
+],
+
+var mona_lisa = [
+" ____",
+" o8%8888,",
+" o88%8888888.",
+" 8'- -:8888b",
+" 8' 8888",
+" d8.-=. ,==-.:888b",
+" >8 `~` :`~' d8888",
+" 88 ,88888",
+" 88b. `-~ ':88888",
+" 888b ~==~ .:88888",
+" 88888o--:':::8888",
+" `88888| :::' 8888b",
+" 8888^^' 8888b",
+" d888 ,%888b.",
+" d88% %%%8--'-.",
+"/88:.__ , _%-' --- -",
+" '''::===..-' = --. `",
+ ]

0 comments on commit 0b92372

Please sign in to comment.