Rabbit Ear is gearing up for a version 1 release. check back in early 2020.

Origami

grab

<!DOCTYPE html>
<title>Rabbit Ear</title>
<script src="rabbit-ear.js"></script>
<script>
RabbitEar.Origami( {"folding":true} );
</script>


This simple app creates the sketch above - a square sheet of paper that you can fold.

Getting Started

Create a new project inside the "sketches" folder by copying and renaming "empty".

There are three files in your sketch:

• index.html open this file to run your sketch.
• style.css set the color of the paper and style the lines.
• sketch.js let's take a closer look:
let origami = RabbitEar.Origami();
// respond to a touch event
origami.onMouseMove = function(event){

}


Examples

This loads an svg image, interprets it like a crease pattern, and folds it.

let origami = RabbitEar.Origami();origami.load("crane.svg");
let origami = RabbitEar.Origami();origami.load("crane.svg");origami.fold();

In some cases Rabbit Ear is capable of determining layer ordering for a folding. When it is unsure it draws translucent faces.

loading a file requires running a localhost server.

This sketch loads a frog base and colors the faces.

let origami = RabbitEar.Origami();
origami.load(RabbitEar.bases.frog);

RabbitEar.core.make_faces_coloring(origami)
.map(color => color ? "#224c72" : "#f1c14f")
.forEach((color, i) =>
origami.faces[i].setAttribute("style", "fill:" + color)
);

A flat-foldable crease pattern is always two-colorable.

Read more about the Origami object, .svg to .fold converters, the math and svg libraries, and more in the following sections.