Skip to content

Commit

Permalink
docs(readme): provide a very short overview
Browse files Browse the repository at this point in the history
  • Loading branch information
colinmeinke committed Jul 26, 2017
1 parent 7e59cae commit 185fbe0
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 17 deletions.
98 changes: 82 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,93 @@
# Wilderness · [![gzip size](http://img.badgesize.io/https://unpkg.com/wilderness/dist/wilderness.production.js?compression=gzip&label=gzip%20size&style=flat)](https://unpkg.com/wilderness/dist/wilderness.production.js) [![test coverage](https://img.shields.io/coveralls/colinmeinke/wilderness/master.svg?style=flat)](https://coveralls.io/github/colinmeinke/wilderness) [![travisci](https://img.shields.io/travis/colinmeinke/wilderness.svg?style=flat)](https://travis-ci.org/colinmeinke/wilderness) [![npm version](https://img.shields.io/npm/v/wilderness.svg?style=flat)](https://www.npmjs.com/package/wilderness)

This is the **next** version on Wilderness, built on top of
[Wilderness core](https://github.com/colinmeinke/wilderness-core).
An SVG animation API.

It's pretty much there. Remaining tasks before it is released:
Wilderness combines a simple API, with the ability to create complex SVG
animations.

- ~~Timeline events~~
- ~~Testing the DOM libraries~~
- ~~Adding code comments to the DOM libraries~~
- Creating documentation
As well as all the things that you would expect an SVG animation library to
include, Wilderness has some very powerful features:

If you'd like to give it a spin right now, download this repo and run:
- **Shape morphing**. Morph from anything, to anything.
- **Full timeline control**. Sequence multiple shapes on a timeline. Control
playback how you want.
- **Middleware**. Create your own functions to transform shapes during animation.

Here is a quick example that shows just how simple it is to morph between two
shapes with Wilderness:

```js
import { shape, timeline, render, play } from 'wilderness'

const svg = document.querySelector('.svg')
const square = svg.querySelector('.square')
const circle = svg.querySelector('.circle')

// 1. Create a shape
// This will create a shape with two keyframes
const morph = shape({ el: square }, { el: circle })

// 2. Place the shape on a timeline
const playbackOptions = { alternate: true, iterations: Infinity }
const animation = timeline(morph, playbackOptions)

// 3. Render the timeline to the SVG
render(svg, animation)

// 4. Start playback of the timeline
play(animation)
```

Full documentation will appear shortly at
[wilderness.now.sh](https://wilderness.now.sh). In the meantime check out the [examples directory](./examples) in this repository.

## Installation

Wilderness can be used as [an ES2015 module](#es2015-module),
[required with commonjs](#commonjs) or
[loaded with an HTML script element](#umd).

First, get a copy of Wilderness by installing the npm distribution:

```
yarn add wilderness
```
yarn install
yarn build

or

```
npm --save wilderness
```

This will build three directories:
Alternatively, you can find the distribution on the [unpkg CDN](https://unpkg.com/wilderness-core/).

- `cjs` for commonjs use
- `modules` for es2015 module use
- `dist` for umd use
### ES2015 module

For the current (relatively) stable version please use
[version v4.1.1](https://github.com/colinmeinke/wilderness/tree/v4.1.1).
```js
import { shape, timeline, render, play } from 'wilderness'
```

### commonjs

```js
const { shape, timeline, render, play } = require('wilderness')
```

### UMD

If you just want to drop a javascript file onto a page, then this is the method
for you.

Look in the `dist` directory of the distribution and select either the [development](https://unpkg.com/wilderness/dist/wilderness.development.js)
or [production](https://unpkg.com/wilderness/dist/wilderness.production.js)
file.

Add a `script` tag linking to the file into your HTML layout, and you will then
have access to the global `Wilderness` object.

```js
const shape = Wilderness.shape
const timeline = Wilderness.timeline
const render = Wilderness.render
const play = Wilderness.play
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"wilderness-core": "^2.2.0",
"wilderness-dom-node": "^1.2.1"
},
"description": "A javascript API for making SVG animations",
"description": "An SVG animation API",
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-plugin-external-helpers": "^6.22.0",
Expand Down

0 comments on commit 185fbe0

Please sign in to comment.