Skip to content

Commit 6249cf8

Browse files
committed
Replaced broken codepen link
1 parent b501076 commit 6249cf8

File tree

1 file changed

+26
-18
lines changed

1 file changed

+26
-18
lines changed

docs/api/modules/html/README.md

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99

1010
## Contents:
1111

12-
- [Full API Reference](#full-api-reference)
13-
- [Other CSS properties](#other-css-properties)
14-
- [Teach mojs with customProperties](#teach-mojs-with-customproperties)
15-
- [Independent deltas](#independent-deltas)
12+
- [Full API Reference](#full-api-reference)
13+
- [Other CSS properties](#other-css-properties)
14+
- [Teach mojs with customProperties](#teach-mojs-with-customproperties)
15+
- [Independent deltas](#independent-deltas)
1616

1717
## Full API Reference:
1818

@@ -198,34 +198,35 @@ Other `CSS` properties would be inferred automatically, please set them in `came
198198

199199
```javascript
200200
const html = new mojs.Html({
201-
el: '#js-el',
202-
borderColor: { 'cyan': '#FA3204' },
203-
borderWidth: { 2: 12 }
201+
el: "#js-el",
202+
borderColor: { cyan: "#FA3204" },
203+
borderWidth: { 2: 12 },
204204
});
205205
```
206206

207-
- [CodePen Example](https://codepen.io/sol0mka/pen/14bcdfac6a89b918ac0292b35c0f156e?editors=0010)
207+
- [CodePen Example](https://codepen.io/sandstedt/pen/vYyazRm)
208208

209209
### Teach mojs with customProperties
210210

211211
If property doesn't work as expected you can teach `mojs` with a `customProperties` definition:
212212

213213
```javascript
214214
const html = new mojs.Html({
215-
el: '#js-el',
215+
el: "#js-el",
216216
customProperties: {
217217
originY: 50,
218218
anotherCustomProp: 0,
219-
draw (el, props) {
220-
el.style['transformOrigin'] = `50% ${props.originY}%`;
221-
}
222-
}
219+
draw(el, props) {
220+
el.style["transformOrigin"] = `50% ${props.originY}%`;
221+
},
222+
},
223223
});
224224
```
225225

226226
`customProperties` object should have
227-
- list of custom properties names with their `default` value (`originY: 50, anotherCustomProp: 0`).
228-
- `draw` function that will be responsible for rendering that custom properties. It will be called on each animation frame and will be provided with `el` and `props` object that contain current states for all custom properties (`props.originY, props.anotherCustomProp`). Feel free to apply that state to the `el` any way that works for you.
227+
228+
- list of custom properties names with their `default` value (`originY: 50, anotherCustomProp: 0`).
229+
- `draw` function that will be responsible for rendering that custom properties. It will be called on each animation frame and will be provided with `el` and `props` object that contain current states for all custom properties (`props.originY, props.anotherCustomProp`). Feel free to apply that state to the `el` any way that works for you.
229230

230231
All custom properties are expected to be plain `numbers`, you can define `units` in the `draw` function.
231232

@@ -237,9 +238,16 @@ All `delta` values of the `Html` module could have entire set of `Tween` propert
237238

238239
```javascript
239240
const html = new mojs.Html({
240-
el: '#js-el',
241-
x: { 200: 0, delay: 200, duration: 2000, easing: 'cubic.in' },
242-
y: { 0: 200, duration: 2000, easing: 'cubic.out', onComplete () { /* ... */ } }
241+
el: "#js-el",
242+
x: { 200: 0, delay: 200, duration: 2000, easing: "cubic.in" },
243+
y: {
244+
0: 200,
245+
duration: 2000,
246+
easing: "cubic.out",
247+
onComplete() {
248+
/* ... */
249+
},
250+
},
243251
});
244252
```
245253

0 commit comments

Comments
 (0)