Paperfold CSS

Fold divs like paper

Built using JavaScript, HTML5, CSS3, Mobile,

  • 98046 views
  • 10 comments

More About This Demo From The Author

I'm currently working on 'buddycloud', a federated social network. This is a proposal for a visual folding-effect for hidden comments.

The plugin takes a dom element, slices it into parts and arranges them like a folded paper in 3d space.

10 comments so far

Register or log in to add your own.

  1. rudolfrck said,

    Great demo! Love the concept.
    Only challenge is that you are animating the height property, which gives poor performance on almost any mobile device because of the repaints. If this could somehow be done with translate or anything similar it would greatly increase the performance.
    1. mrflix said,

      Rudol, great point.
      While developing I checked it using Safari's awesome hardware-acceleration debugger and wonderd where the repaints come from. Now as you name its obviouse that it's triggered by the height. Changing that to a translation on the y-axis seems not to hard to implement: I can move everything down via translation. It just seems quite complex if there are following posts. Can I move them down using the normal element-flow (e.g. no translation) without redraw?triggers
  2. onkelyoo said,

    great job (Echt man krass :D). I just started learning HTML, CSS and JS but this is really nice. RESPECT! Greetings from Hamburg!
    1. mrflix said,

      Hey, schön was aus Hamburg zu hören. Da muss ich bald mal hin tuckeln - is ja nich weit von Berlin. Einfach dran bleiben - bin vor drei Jahren auch am Anfang gestanden. Es macht echt Spass, wenn du zu dem Punkt kommst, an dem du einfach alles basteln kannst so wie du es dir vorstellst.
  3. IvanMoreno said,

    Nice stuff!
  4. doktor said,

    Very sexy - love the effect... but... change height to 344 and click Open - goes into endless loop and never completes task - Chrome, latest cut at the time of writing
  5. mattx said,

    awesome!!!!
  6. Subbu said,

    Hi,
    Its a great, demo, but i find some problem with it.
    If i adjust "time","3d" everything is fine.
    When the height is adjust (not the default) to 230 or something, the timer bar goes left-right and back
    Is it a bug or something

    -Subbu
  7. apaatsio said,

    Very nice. Have you assessed the performance? On a new desktop it seems to work fine but how about mobile devices?

    And I noticed the folding doesn't work with canvas elements. The folded version only shows an empty canvas even if the original canvas had some graphics in it. I believe the cloning of elements loses the canvas data and you need to redraw each canvas clone separately.
    1. mrflix said,

      Oh yes, makes sense that the information on canvases gets lost on the way.
      I tested the demo on an iPod touch (4th gen.) and an iPad 2 and it performed well.
      The performance bottleneck lies in the cloning of the elements. I see two solutions for that: 1.) background: element (http://hacks.mozilla.org/2010/08/mozelement/) and 2.) arbitrary folds - fold for each div. Therefore the animation has to be calculated in Javascript - so that's no optimal solution. Though - one might be able to generate a fitting bezier curve for every slide and then animate via css-transitions.

Get the Source Code

Download the Source 74.16 KB · ZIP File

This demo is released under the Public Domain (where applicable by law) license.