Skip to content

Commit a38f501

Browse files
committed
Updated the getting started guide and added mo-js as a dependency
1 parent 460690a commit a38f501

File tree

8 files changed

+202
-10
lines changed

8 files changed

+202
-10
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<template>
2+
<div class="interactive-code">
3+
<slot></slot>
4+
<div id="circle-anim" class="example-anim"></div>
5+
</div>
6+
</template>
7+
8+
<script>
9+
import mojs from 'mo-js';
10+
11+
export default {
12+
13+
mounted: function () {
14+
var circle = new mojs.Shape({
15+
parent: '#circle-anim',
16+
shape: 'circle',
17+
fill: {'#F64040': '#FC46AD'},
18+
radius: {20: 80},
19+
duration: 2000,
20+
isYoyo: true,
21+
easing: 'elastic.inout',
22+
repeat: 999,
23+
})
24+
.play();
25+
}
26+
27+
}
28+
</script>
29+
30+
<style>
31+
.test {
32+
background: #f1e2d7;
33+
width: 100%;
34+
height: 400px;
35+
position: relative;
36+
}
37+
.test svg {
38+
overflow: visible
39+
}
40+
41+
</style>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<template>
2+
<div class="interactive-code">
3+
<slot></slot>
4+
<div :id="this.id" class="example-anim" :style="style"></div>
5+
</div>
6+
</template>
7+
8+
<script>
9+
import mojs from 'mo-js';
10+
11+
export default {
12+
props: {
13+
id: { type: String, default: '#code-example' },
14+
height: { type: String, default: '300px' },
15+
},
16+
17+
computed: {
18+
style () {
19+
return 'height: ' + this.height;
20+
}
21+
},
22+
23+
mounted: function () {
24+
var loader = new mojs.Shape({
25+
parent: '#' + this.id,
26+
shape: 'circle',
27+
stroke: '#FC46AD',
28+
strokeDasharray: '125, 125',
29+
strokeDashoffset: {'0': '-125'},
30+
strokeWidth: 4,
31+
fill: 'none',
32+
left: '50%',
33+
top: '50%',
34+
angle: {'-90': '270'},
35+
radius: 20,
36+
isShowStart: true,
37+
duration: 2000,
38+
easing: 'back.in',
39+
})
40+
.then({
41+
angle: {'-90': '270'},
42+
strokeDashoffset: {'-125': '-250'},
43+
duration: 3000,
44+
easing: 'cubic.out',
45+
onComplete () {
46+
loader.replay(0); // create an infinite loop
47+
}
48+
})
49+
.play();
50+
}
51+
52+
}
53+
54+
55+
</script>

docs/.vuepress/styles/index.styl

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,18 @@ html, body {
6666
background-color transparent
6767
border 1px solid $c-orange
6868
border-radius 3px
69-
user-select all
69+
user-select all // autoselect smaller inline styles but not larger code blocks that has a language specified
7070
}
7171
pre {
7272
code {
7373
border none
7474
}
7575
}
76+
.language-javascript, .language-js, .language-jsx {
77+
code {
78+
user-select auto
79+
}
80+
}
7681
}
7782

7883
}
@@ -97,3 +102,12 @@ hr
97102
background: $c-purple url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjY0cHgiIGhlaWdodD0iMTRweCIgdmlld0JveD0iMCAwIDY0IDE0IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy4zLjIgKDEyMDQzKSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5VbnRpdGxlZCA3PC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc2tldGNoOnR5cGU9Ik1TUGFnZSI+CiAgICAgICAgPGNpcmNsZSBpZD0iT3ZhbC0xMSIgc3Ryb2tlPSIjRkYzQzQwIiBza2V0Y2g6dHlwZT0iTVNTaGFwZUdyb3VwIiBjeD0iNyIgY3k9IjciIHI9IjYiPjwvY2lyY2xlPgogICAgICAgIDxyZWN0IGlkPSJSZWN0YW5nbGUtNTMiIHN0cm9rZT0iIzUwRTNDMiIgc2tldGNoOnR5cGU9Ik1TU2hhcGVHcm91cCIgeD0iMjYiIHk9IjEiIHdpZHRoPSIxMiIgaGVpZ2h0PSIxMiI+PC9yZWN0PgogICAgICAgIDxnIGlkPSJQYXRoLTI4LSstUGF0aC0yOSIgc2tldGNoOnR5cGU9Ik1TTGF5ZXJHcm91cCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNTEuMDAwMDAwLCAxLjAwMDAwMCkiIHN0cm9rZT0iI0ZGRDk0QiI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0wLjM2MDY3NzA4MywwLjM5NDUzMTI1IEwxMS45MTUzNjQ2LDExLjc2MDQxNjciIGlkPSJQYXRoLTI4IiBza2V0Y2g6dHlwZT0iTVNTaGFwZUdyb3VwIj48L3BhdGg+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0wLjcwODMzMzMzMywxMS41NTcyOTE3IEwxMi4wNTk4OTU4LDAuNTUyMDgzMzMzIiBpZD0iUGF0aC0yOSIgc2tldGNoOnR5cGU9Ik1TU2hhcGVHcm91cCI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+') no-repeat
98103

99104

105+
.example-anim {
106+
background: #f1e2d7;
107+
width: 100%;
108+
height: 300px;
109+
position: relative;
110+
svg {
111+
overflow: visible // for overshoots animations
112+
}
113+
}

docs/.vuepress/styles/palette.styl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ $c-purple-light = #4E214D
1414
$c-purple-dark = #2b062a
1515
$c-white = #FDF7F7
1616

17-
$c-creamy = rgb(241, 226, 215)
17+
$c-creamy = rgb(241, 226, 215) // #f1e2d7
1818

1919
$c-orange-semi = rgba($c-orange, 0.5)
2020
// c-white-transparent = rgba(white, .2)

docs/tutorials/getting-started.md

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,66 @@
1+
12
# Getting started
23

3-
## Setup mo · js in your project
4-
- Run `npm i @mojs/mojs -D` OR `yarn add -D @mojs/mojs`
5-
- Import it `import mojs from 'mojs'`
4+
## Setup mo.js in your project
5+
- Run `npm i mo-js` OR `yarn add mo-js`
6+
- Import it `import mojs from 'mo-js'`
7+
8+
Or use the minified CDN version:
9+
```js
10+
<script src="http://cdn.jsdelivr.net/mojs/latest/mo.min.js"></script>
11+
```
12+
13+
- Create your animations. What about a bouncy circle?
14+
15+
<ExampleCircle>
16+
```js
17+
var circle = new mojs.Shape({
18+
parent: '#circle-anim',
19+
shape: 'circle',
20+
fill: {'#F64040': '#FC46AD'},
21+
radius: {20: 80},
22+
duration: 2000,
23+
isYoyo: true,
24+
easing: 'elastic.inout',
25+
repeat: 999,
26+
})
27+
.play();
28+
```
29+
</ExampleCircle>
630

7-
Or use the minified CDN version:
31+
Or maybe a loading animation?
32+
33+
<ExampleSpinner height="200px" id="spinner">
834
```js
9-
<script src="http://cdn.jsdelivr.net/mojs/latest/mo.min.js"></script>
35+
var loader = new mojs.Shape({
36+
parent: '#spinner',
37+
shape: 'circle',
38+
stroke: '#FC46AD',
39+
strokeDasharray: '125, 125',
40+
strokeDashoffset: {'0': '-125'},
41+
strokeWidth: 4,
42+
fill: 'none',
43+
left: '50%',
44+
top: '50%',
45+
angle: {'-90': '270'},
46+
radius: 20,
47+
isShowStart: true,
48+
duration: 2000,
49+
easing: 'back.in',
50+
})
51+
.then({
52+
angle: {'-90': '270'},
53+
strokeDashoffset: {'-125': '-250'},
54+
duration: 3000,
55+
easing: 'cubic.out',
56+
onComplete () {
57+
loader.replay(0); // create an infinite loop
58+
}
59+
})
60+
.play();
1061
```
62+
</ExampleSpinner>
63+
64+
Go creative!
1165

1266
See the [API](/api/README.md) for more info.

docs/tutorials/shape-swirl.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22

33
- [CodePen Example](https://codepen.io/sol0mka/pen/pbebwQ?editors=0010)
44
- [API reference](api/shape-swirl)
5+
6+
Coming soon

package-lock.json

Lines changed: 25 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@
99
"devDependencies": {
1010
"vuepress": "^1.0.0-alpha.47"
1111
},
12-
"deploy": "npm run build"
12+
"deploy": "npm run build",
13+
"dependencies": {
14+
"mo-js": "^0.288.2"
15+
}
1316
}

0 commit comments

Comments
 (0)