You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`MojsCurveEditor` is a GUI plugin for interactive `custom easings`/`property curves` editing while crafting your animations. Part of `mojs` tools.
6
8
7
9
## Installation
8
10
9
-
The `MojsCurveEditor` depends on `mojs >= 0.225.2`, tween autoupdates available for `mojs >= 0.276.2`. Please make sure you've linked [mojs](https://github.com/legomushroom/mojs) library first.
11
+
The `MojsCurveEditor` depends on `mojs >= 0.225.2`, tween autoupdates available for `mojs >= 0.276.2`. Please make sure you've linked [mojs](https://github.com/mojs/mojs) library first.
If you installed it with script link - you should have `MojsCurveEditor` global.
30
+
> If you installed it with script link - you should have `MojsCurveEditor` global
38
31
39
32
## Usage
40
33
41
34
Construct `MojsCurveEditor` with the next options:
42
35
43
36
```javascript
44
37
constmojsCurve=newMojsCurveEditor({
45
-
// Name of the Curve you are working on. The name is used to
38
+
39
+
// name of the Curve you are working on. The name is used to
46
40
// identify record in `localStorage` to restore the state from
47
41
// when page gets reloaded, so please specify unique names if
48
42
// you use more than one editor on the same page.
49
-
name:'bounce curve'
43
+
name:'bounce curve'
50
44
});
51
45
```
52
46
53
-
After that you can "connect" the curve with your `mojs` modules by passing a "sample" of the curve to the `easing` property of the modules like this:
47
+
After that you can "connect" the curve with your `mojs` modules by passing a "sample" of the curve to the `easing` property of the module, like this:
54
48
55
49
```javascript
56
50
constmojsCurve=newMojsCurveEditor();
@@ -68,8 +62,8 @@ After that you can "connect" the curve with your `mojs` modules by passing a "sa
68
62
// or as `property curve`
69
63
70
64
consthtml=newmojs.Html({
71
-
el:'#js-el',
72
-
x: { 100:100, curve:mojsCurve.getEasing() }
65
+
el:'#js-el',
66
+
x:{ 0:100, curve:mojsCurve.getEasing() }
73
67
});
74
68
75
69
```
@@ -81,23 +75,20 @@ If you use `mojs>0.276.5` the state of the modules with the curve `sample` will
81
75
The `getEasing` function receives options hash:
82
76
83
77
```javascript
84
-
// ...
85
78
easing:mojsCurve.getEasing({
86
-
// `transform` function that pipes thru the current value
79
+
// `transform` function that pipes through the current value
87
80
// of the curve so you can transform it
88
81
transform: (k) => { return k; }
89
82
});
90
-
// ...
91
83
92
84
```
93
85
94
86
After you are happy with the curve you made, you need to change the `sample`(`mojsCurve.getEasing()` calls) with actual path data which you can get by clicking on the `code` button (<imgwidth="32"style="margin-bottom: -10px"src="https://github.com/legomushroom/mojs-curve-editor/blob/master/mockups/code-button.png?raw=true"alt="code button" />):
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
176
-
177
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
178
-
179
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0 commit comments