illusion-number
Advanced tools
Comparing version 0.1.1 to 0.2.0
{ | ||
"name": "illusion-number", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"homepage": "https://github.com/malash/illusion-number", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -171,2 +171,5 @@ !(function(document, window) { | ||
eleTiles.classList.add('illusion-number-tiles'); | ||
if (options.reverse) { | ||
eleTiles.classList.add('illusion-number-tiles-reverse'); | ||
} | ||
for (var indexSurface in ['in', 'out']) { | ||
@@ -182,3 +185,3 @@ var surface = ['in', 'out'][indexSurface]; | ||
eleTile.classList.add('illusion-number-tile-y-' + y); | ||
eleTile.classList.add('illusion-number-animation-' + surface + '-' + tilePosition); | ||
eleTile.classList.add('illusion-number-animation-' + surface + '-' + tilePosition); | ||
if (options.animationDuration && !isNaN(parseFloat(options.animationDuration))) { | ||
@@ -185,0 +188,0 @@ eleTile.style.animationDuration = parseFloat(options.animationDuration) + 's'; |
@@ -1,1 +0,1 @@ | ||
!function(n,i){function r(n,i,r){return void 0===a[n]?0:void 0===a[n][i]?0:void 0===a[n][i][r]?0:a[n][i][r]}function o(n,i){var o,e,a,t={"in":[],out:[]};for(o=0;5>o;o++)for(t["in"][o]=[],t.out[o]=[],e=0;3>e;e++){if(t.out[o][e]=[],r(n,o,e))for(a=0;3>a;a++)!r(i,o,a-1)&&r(i,o,a)&&t.out[o][e].push(a+1);if(t["in"][o][e]=[],r(i,o,e))for(a=2;a>=0;a--)!r(n,o,a+1)&&r(n,o,a)&&t["in"][o][e].push(3-a)}return t}function e(n){return console&&console.error&&console.error(n),n}var a={0:[[1,1,1],[1,0,1],[1,0,1],[1,0,1],[1,1,1]],1:[[1,1,0],[0,1,0],[0,1,0],[0,1,0],[1,1,1]],2:[[1,1,1],[0,0,1],[1,1,1],[1,0,0],[1,1,1]],3:[[1,1,1],[0,0,1],[0,1,1],[0,0,1],[1,1,1]],4:[[1,0,1],[1,0,1],[1,1,1],[0,0,1],[0,0,1]],5:[[1,1,1],[1,0,0],[1,1,1],[0,0,1],[1,1,1]],6:[[1,1,1],[1,0,0],[1,1,1],[1,0,1],[1,1,1]],7:[[1,1,1],[0,0,1],[0,0,1],[0,0,1],[0,0,1]],8:[[1,1,1],[1,0,1],[1,1,1],[1,0,1],[1,1,1]],9:[[1,1,1],[1,0,1],[1,1,1],[0,0,1],[1,1,1]]};i.IllusionNumber={play:function(i,r){if(r=r||{},!i)return e(new Error("IllusionNumber.play: "+i+" is not an invalid element"));var t=r.from;if("undefined"==typeof t||"undefined"==typeof a[t])return e(new Error("IllusionNumber.play: "+t+" is not an invalid 'from' char"));var l=r.to;if("undefined"==typeof l&&(l=(parseInt(t)+1)%10),"undefined"==typeof a[l])return e(new Error("IllusionNumber.play: "+l+" is not an invalid 'to' char"));var s=r.size||"250px";parseFloat(s)==s&&(s+="px");var u;/^((\d+)(\.\d+)?)([^\d]+)$/.test(s)&&(u=s.match(/^((\d+)(\.\d+)?)([^\d]+)$/),s=parseFloat(u[1])/6+u[4]),tilePositionsMap=o(t,l);var d=n.createElement("div");d.classList.add("illusion-number"),d.style.fontSize=s;var f=n.createElement("div");f.classList.add("illusion-number-tiles");for(var p in["in","out"])for(var m=["in","out"][p],v=0;5>v;v++)for(var c=0;3>c;c++){var y=tilePositionsMap[m][v][c];for(var b in y){var h=y[b],E=n.createElement("div");E.classList.add("illusion-number-tile-x-"+v),E.classList.add("illusion-number-tile-y-"+c),E.classList.add("illusion-number-animation-"+m+"-"+h),r.animationDuration&&!isNaN(parseFloat(r.animationDuration))&&(E.style.animationDuration=parseFloat(r.animationDuration)+"s"),f.appendChild(E)}}d.appendChild(f),i.innerHTML="",i.appendChild(d)},setBitmap:function(n,i){a[n]=i}}}(document,window); | ||
!function(n,i){function r(n,i,r){return void 0===a[n]?0:void 0===a[n][i]?0:void 0===a[n][i][r]?0:a[n][i][r]}function e(n,i){var e,o,a,t={"in":[],out:[]};for(e=0;5>e;e++)for(t["in"][e]=[],t.out[e]=[],o=0;3>o;o++){if(t.out[e][o]=[],r(n,e,o))for(a=0;3>a;a++)!r(i,e,a-1)&&r(i,e,a)&&t.out[e][o].push(a+1);if(t["in"][e][o]=[],r(i,e,o))for(a=2;a>=0;a--)!r(n,e,a+1)&&r(n,e,a)&&t["in"][e][o].push(3-a)}return t}function o(n){return console&&console.error&&console.error(n),n}var a={0:[[1,1,1],[1,0,1],[1,0,1],[1,0,1],[1,1,1]],1:[[1,1,0],[0,1,0],[0,1,0],[0,1,0],[1,1,1]],2:[[1,1,1],[0,0,1],[1,1,1],[1,0,0],[1,1,1]],3:[[1,1,1],[0,0,1],[0,1,1],[0,0,1],[1,1,1]],4:[[1,0,1],[1,0,1],[1,1,1],[0,0,1],[0,0,1]],5:[[1,1,1],[1,0,0],[1,1,1],[0,0,1],[1,1,1]],6:[[1,1,1],[1,0,0],[1,1,1],[1,0,1],[1,1,1]],7:[[1,1,1],[0,0,1],[0,0,1],[0,0,1],[0,0,1]],8:[[1,1,1],[1,0,1],[1,1,1],[1,0,1],[1,1,1]],9:[[1,1,1],[1,0,1],[1,1,1],[0,0,1],[1,1,1]]};i.IllusionNumber={play:function(i,r){if(r=r||{},!i)return o(new Error("IllusionNumber.play: "+i+" is not an invalid element"));var t=r.from;if("undefined"==typeof t||"undefined"==typeof a[t])return o(new Error("IllusionNumber.play: "+t+" is not an invalid 'from' char"));var s=r.to;if("undefined"==typeof s&&(s=(parseInt(t)+1)%10),"undefined"==typeof a[s])return o(new Error("IllusionNumber.play: "+s+" is not an invalid 'to' char"));var l=r.size||"250px";parseFloat(l)==l&&(l+="px");var u;/^((\d+)(\.\d+)?)([^\d]+)$/.test(l)&&(u=l.match(/^((\d+)(\.\d+)?)([^\d]+)$/),l=parseFloat(u[1])/6+u[4]),tilePositionsMap=e(t,s);var d=n.createElement("div");d.classList.add("illusion-number"),d.style.fontSize=l;var f=n.createElement("div");f.classList.add("illusion-number-tiles"),r.reverse&&f.classList.add("illusion-number-tiles-reverse");for(var p in["in","out"])for(var v=["in","out"][p],m=0;5>m;m++)for(var c=0;3>c;c++){var y=tilePositionsMap[v][m][c];for(var b in y){var h=y[b],L=n.createElement("div");L.classList.add("illusion-number-tile-x-"+m),L.classList.add("illusion-number-tile-y-"+c),L.classList.add("illusion-number-animation-"+v+"-"+h),r.animationDuration&&!isNaN(parseFloat(r.animationDuration))&&(L.style.animationDuration=parseFloat(r.animationDuration)+"s"),f.appendChild(L)}}d.appendChild(f),i.innerHTML="",i.appendChild(d)},setBitmap:function(n,i){a[n]=i}}}(document,window); |
{ | ||
"name": "illusion-number", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "Illusion Number", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -90,2 +90,10 @@ # Illusion Number | ||
#### options.reverse | ||
Type: `boolean` | ||
Default: `false` | ||
If `options.reverse` is `true`, the anamation direction will be reversed. | ||
### IllusionNumber.setBitmap(char, bitmap) | ||
@@ -128,2 +136,20 @@ | ||
## Development | ||
We use `gulp` as build system. | ||
For development: | ||
```bash | ||
npm install | ||
gulp dev | ||
``` | ||
For build: | ||
```bash | ||
npm install | ||
gulp build | ||
``` | ||
## License | ||
@@ -130,0 +156,0 @@ |
@@ -171,2 +171,5 @@ !(function(document, window) { | ||
eleTiles.classList.add('illusion-number-tiles'); | ||
if (options.reverse) { | ||
eleTiles.classList.add('illusion-number-tiles-reverse'); | ||
} | ||
for (var indexSurface in ['in', 'out']) { | ||
@@ -182,3 +185,3 @@ var surface = ['in', 'out'][indexSurface]; | ||
eleTile.classList.add('illusion-number-tile-y-' + y); | ||
eleTile.classList.add('illusion-number-animation-' + surface + '-' + tilePosition); | ||
eleTile.classList.add('illusion-number-animation-' + surface + '-' + tilePosition); | ||
if (options.animationDuration && !isNaN(parseFloat(options.animationDuration))) { | ||
@@ -185,0 +188,0 @@ eleTile.style.animationDuration = parseFloat(options.animationDuration) + 's'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
55887
759
176