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
{{ message }}
This repository was archived by the owner on May 21, 2025. It is now read-only.
A method called every frame with the current driverValues and domElement. This could be used to toggle classes on an element or set innerHTML. See it in action [here](https://alexfox.dev/lax.js/examples/on-update).
182
+
183
+
The driver values are formatted as follows:
184
+
```js
185
+
{
186
+
scrollY: [ // Driver name
187
+
100, // Driver value
188
+
0// Driver inertia
189
+
]
190
+
}
191
+
```
192
+
180
193
# Going deeper
181
194
182
195
## Custom animations
@@ -206,7 +219,7 @@ The name of the driver you want to use as a source of values to map to your anim
206
219
### CSS property
207
220
The name of the CSS property you want to animate, for example `opacity` or `rotate`. See a list of supported properties [here](#css-properties).
208
221
209
-
> Some css properties, for example `box-shadow`, require a custom function to build the style string. To do this use the [cssFn](#cssfn-value-number--string) element option.
222
+
> Some CSS properties, for example `box-shadow`, require a custom function to build the style string. To do this use the [cssFn](#cssfn-value-number--string) element option.
210
223
211
224
### Value maps
212
225
The value maps are used to interpolate the driver value and output a value for your CSS property. For example:
@@ -270,20 +283,7 @@ Use in combination with `inertia`. If set to `absolute` the inertia value will a
270
283
Define the unit to be appended to the end of the value, for example
A method called every frame with the current driverValues and domElement. This could be used to toggle classes on an element or set innerHTML. See it in action [here](https://alexfox.dev/lax.js/examples/on-update).
275
-
276
-
The driver values are formatted as follows:
277
-
```js
278
-
{
279
-
scrollY: [ // Drivr name
280
-
100, // Driver value
281
-
0// Driver inertia
282
-
]
283
-
}
284
-
```
285
-
286
-
#### `cssFn: (value: number) => string`
286
+
#### `cssFn: (value: number, domElement: DomElement) => number | string`
287
287
Some CSS properties require more complex strings as values. For example, `box-shadow` has multiple values that could be modified by a lax animation.
288
288
289
289
```javascript
@@ -293,6 +293,9 @@ Some CSS properties require more complex strings as values. For example, `box-sh
293
293
};
294
294
```
295
295
296
+
#### `easing: string`
297
+
See a list of available values [here](#supported-easings).
298
+
296
299
## Optimising performance
297
300
Lax.js has been designed to be performant but there are a few things to bare in mind when creating your websites.
0 commit comments