Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 2 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
@@ -1,90 +1,90 @@
# Space.js
A HTML-driven JavaScript-library for narrative 3D-scrolling.

See the demos [here](http://www.slashie.org/space.js/)

**NOTE THAT SHOULD BE CONSIDERED TO BE BETA SOFTWARE**
*Production use is not recommended at this point.*

## Usage

**Import the library**
```html
<head>
Expand All @@ -19,56 +16,40 @@ See the demos [here](http://www.slashie.org/space.js/)
<script type="text/javascript" src="space.min.js"></script>
</body>
```

The library is HTML-driven, which means that you don't need to write a single line of JavaScript to use it on your site and still have a lot of flexibility!

The core of the library is to divide our HTML into frames, or *space-frames* as we call them her (to not conflict the common class name "frame").


### Creating a frame
```html
<div class="space-frame">[contents]</div>
```

I would also **strongly** recommend using an inner-frame inside the space-frame, which provides some helpful CSS to make things centered both vertically and horizontally inside the frame.

```html
<div class="space-frame">
<section class="space-inner-frame">
[contents]
</section>
</div>
```

### Custom duration
If we want we can provide a custom duration for our frames with the data-duration attribute, which multiplies the default duration of the transition.

```html
<section class="space-frame" data-duration="1.4">...</section>
<section class="space-frame" data-duration="0.6">...</section>
```


### Options
Space.js has a default default transition - which is to enter by fading in and exit by scaling up and fading out. We can also provide a custom transition override to the library from predefined transitions. (We can also create our own transitions from scratch, but we'll get to that later.)

```html
<section class="space-frame" data-transition="rotate360">...</section>
```

Multiple values are supported!

```html
<section class="space-frame" data-transition="rotate360 fadeOut slideInLeft">...</section>
```

### Custom entry and exit
If we really want to get into detail, we can provide how we wish the frame to enter (first half of the frame duration) and exit (second half).

```html
<section class="space-frame" data-enter="fadeIn" data-exit="fadeOut zoomOut">...</section>
```

## What a complete frame could look like
```html
<div class="space-frame" data-enter="fadeIn" data-exit="zoomOut fadeOut" data-duration="1.3">
Expand All @@ -85,10 +66,10 @@ If we really want to get into detail, we can provide how we wish the frame to en

## Custom transitions
You can add your own transitions with the ```addTransitions`` method. Make sure it is done after the library is loaded.
You can add your own transitions with the ``addTransitions`` method. Make sure it is done after the library is loaded.

```javascript
<script src="space.js"></script>

<script type="text/javascript">
var transitions = {
rotate720: {
Expand All @@ -101,10 +82,8 @@ You can add your own transitions with the ```addTransitions`` method. Make sure
Space.addTransitions(transitions);
</script>
```

### Currently supported transitions
Note that these might come to change during the beta-phase of the library.

- scaleIn
- fadeIn
- scaleOut
Expand All @@ -123,4 +102,3 @@ Note that these might come to change during the beta-phase of the library.
- slideBottomRight
- rotate360
- rotate3dOut