30 April 2013

The Jurassic Park book code

Hi,
I saw this video:




Like some others I also found that the pattern goes

1st folding: 
2nd folding: 
4th folding: 
5th folding: 
6th folding: 
...
Where new valley is , new peak and a piece of paper.


In the previous pattern it was folded left six times. But we can also arbitrarily fold right or left. For example LRLRLRLRLRLR forms a triangle.
So I've made this demo about it that I'd like to share:


Center demo
Folding...
Folds: | Creases: | Paper length: |
Center demo
  • Javascript programming side notes:
    • - Used
      • jQuery,
      • jQuery UI:
        • looks pretty;
        • had to fix the checkbox label being text selectable and disabling toggle;
        • the spinner thingy: why not make the container an input element so you can catch the onchange event? if not, don't make it directly editable...
        • progressbar can be too demanding from browser, moreover when you have the progress tag.
    • - Didn't use
      • SVG: internet says it could be slow and I decided to believe it for this.
      • webGL: would like to try but was not a priority because Microsoft does not support it. In any following opportunity it will be, despite that.
      • web workers: the heavy lifting is the canvas drawing operations so no point in those while that's the case.
      • could have used more foldrs in it.

No comments:

Post a Comment