Skip to content

Commit

Permalink
Added more examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
Christine Cha committed Sep 25, 2016
1 parent 05c2270 commit 210bec7
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .npmignore
@@ -1,6 +1,7 @@
/examples/
/src/
/assets/
webpack.config.js
index.html
index.js
index.css
webpack.config.js
21 changes: 18 additions & 3 deletions examples/one.html
Expand Up @@ -2,22 +2,37 @@
<html>
<head>
<meta charset="utf-8">
<title></title>
<title>Choreographer-JS | Example One</title>
</head>

<body>
<style>
p {
position: fixed;
top: 100px;
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.1em;
font-family: 'Arial', sans-serif;
color: white;
text-align: center;
width: 100%;
z-index: 1;
}

#box {
margin: 0 0;
width: 100%;
height: 500vh;
background: black;
opacity: 0.2;
}
</style>


<p>Animating based on scroll location.</p>
<div id="box"></div>

<script src="/dist/choreographer.min.js"></script>
<script src="../dist/choreographer.min.js"></script>
<script>
let choreographer = new Choreographer({
animations: [
Expand Down
52 changes: 52 additions & 0 deletions examples/three.html
@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Choreographer-JS | Example Three</title>
</head>

<body>
<style>
p {
position: fixed;
top: 100px;
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.1em;
font-family: 'Arial', sans-serif;
color: white;
text-align: center;
width: 100%;
z-index: 1;
}

#box {
margin: 0 0;
width: 100vw;
height: 100vh;
background-color: black;
opacity: 0.2;

transition: background-color 0.4s ease-in-out;
}
</style>

<p>Multiple animations based on mouse movement.</p>
<div id="box"></div>

<script src="../dist/choreographer.min.js"></script>
<script>
let choreographer = new Choreographer({
animations: [
{ range: [-1, window.innerWidth], selector: '#box', type: 'scale', style: 'height', from: 100, to: 50, unit: 'vh' },
{ range: [-1, window.innerWidth / 2], selector: '#box', type: 'scale', style: 'opacity', from: 0.2, to: 1 },
{ range: [window.innerWidth / 2, window.innerWidth], selector: '#box', type: 'change', style: 'backgroundColor', to: '#00c9ff' },
]
})

window.addEventListener('mousemove', (e) => {
choreographer.runAnimationsAt(e.clientX)
})
</script>
</body>
</html>
55 changes: 55 additions & 0 deletions examples/two.html
@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Choreographer-JS | Example Two</title>
</head>

<body>
<style>
p {
position: fixed;
top: 100px;
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.1em;
font-family: 'Arial', sans-serif;
color: white;
text-align: center;
width: 100%;
z-index: 1;
}

#box {
margin: 0 0;
width: 100vw;
height: 100vh;
background: black;
opacity: 0.2;
}
</style>

<p>Animating based on mouse movement.</p>
<div id="box"></div>

<script src="../dist/choreographer.min.js"></script>
<script>
let choreographer = new Choreographer({
animations: [
{
range: [-1, window.innerWidth],
selector: '#box',
type: 'scale',
style: 'opacity',
from: 0.2,
to: 1
}
]
})

window.addEventListener('mousemove', (e) => {
choreographer.runAnimationsAt(e.clientX)
})
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "choreographer-js",
"version": "1.0.3",
"version": "1.0.4",
"description": "A simple library to take care of complicated animations.",
"main": "dist/index.js",
"scripts": {
Expand Down

0 comments on commit 210bec7

Please sign in to comment.