keyframekit 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -20
- package/docs/.vitepress/config.ts +7 -2
- package/docs/docs/index.md +24 -19
- package/docs/docs/public/og-image.png +0 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
# [KeyframeKit](https://keyframekit.berryscript.com)
|
|
2
2
|
|
|
3
3
|
Intuitive, powerful and performant tools for working with CSS animations in JavaScript.
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
## About
|
|
6
|
+
|
|
7
|
+
While working with the [Web Animations API][1], I was surprised there wasn't an easy way to import animation keyframes directly from your CSS. You had to re-define them in JS, using a completely different format. So, I wrote a typed, spec-compliant library to convert. Along the way, I also added some other useful utilities for working with the API.
|
|
5
8
|
|
|
6
9
|
## Installation
|
|
7
10
|
|
|
@@ -54,9 +57,28 @@ await attachedAnim.finished;
|
|
|
54
57
|
```
|
|
55
58
|
[...and more.][2]
|
|
56
59
|
|
|
60
|
+
### Importing a stylesheet directly
|
|
61
|
+
|
|
62
|
+
Instead of getting an animation from the document's stylesheets, you can also import it directly from a CSS file.
|
|
63
|
+
|
|
64
|
+
```js
|
|
65
|
+
import KeyframeKit from 'keyframekit';
|
|
66
|
+
|
|
67
|
+
const styleSheet = await KeyframeKit.importStyleSheet('./styles.css');
|
|
68
|
+
|
|
69
|
+
// get animation keyframes from stylesheet
|
|
70
|
+
const rotateSmallAnimKeyframes = KeyframeKit.getStyleSheetKeyframes({
|
|
71
|
+
of: 'rotate-small',
|
|
72
|
+
in: styleSheet
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
> Note: `@import` rules won't be resolved in stylesheets imported in this way. [More info.][3]
|
|
77
|
+
|
|
57
78
|
### Defining animations in JS
|
|
58
79
|
|
|
59
|
-
|
|
80
|
+
The `KeyframeEffectParameters` class provides a more convenient way to define your animations in JS than is offered natively.
|
|
81
|
+
It's useful for when you want to have all your animation code in one place.
|
|
60
82
|
|
|
61
83
|
```js
|
|
62
84
|
import { KeyframeEffectParameters } from 'keyframekit';
|
|
@@ -87,24 +109,6 @@ const attachedAnim = linkTextHoverAnim.toAnimation({
|
|
|
87
109
|
attachedAnim.play();
|
|
88
110
|
```
|
|
89
111
|
|
|
90
|
-
### Importing a stylesheet directly
|
|
91
|
-
|
|
92
|
-
Instead of getting an animation from the document's stylesheets, you can also import it directly from a CSS file.
|
|
93
|
-
|
|
94
|
-
```js
|
|
95
|
-
import KeyframeKit from 'keyframekit';
|
|
96
|
-
|
|
97
|
-
const styleSheet = await KeyframeKit.importStyleSheet('./styles.css');
|
|
98
|
-
|
|
99
|
-
// get animation keyframes from stylesheet
|
|
100
|
-
const rotateSmallAnimKeyframes = KeyframeKit.getStyleSheetKeyframes({
|
|
101
|
-
of: 'rotate-small',
|
|
102
|
-
in: styleSheet
|
|
103
|
-
});
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
> Note: `@import` rules won't be resolved in stylesheets imported in this way. [More info.][3]
|
|
107
|
-
|
|
108
112
|
### Full reference
|
|
109
113
|
[See here.](/reference)
|
|
110
114
|
|
|
@@ -11,10 +11,15 @@ export default defineConfig({
|
|
|
11
11
|
//'reference/:slug*': ':slug*'
|
|
12
12
|
},
|
|
13
13
|
|
|
14
|
-
head: [
|
|
14
|
+
head: [
|
|
15
|
+
['link', { rel: 'icon', href: '/icon.png' }],
|
|
16
|
+
['meta', { property: 'og:image', content: '/og-image.png' }],
|
|
17
|
+
['meta', { name: 'keywords', content: 'css,js,javascript,animation,keyframe,stylesheet,framework,tools,performance,typescript' }]
|
|
18
|
+
],
|
|
15
19
|
|
|
16
20
|
title: "KeyframeKit",
|
|
17
|
-
description: "
|
|
21
|
+
description: "Intuitive, powerful and performant tools for working with CSS animations in JavaScript.",
|
|
22
|
+
|
|
18
23
|
themeConfig: {
|
|
19
24
|
outline: [2, 3],
|
|
20
25
|
|
package/docs/docs/index.md
CHANGED
|
@@ -16,6 +16,10 @@ hero:
|
|
|
16
16
|
|
|
17
17
|
<Playground/>
|
|
18
18
|
|
|
19
|
+
## About
|
|
20
|
+
|
|
21
|
+
While working with the [Web Animations API][1], I was surprised there wasn't an easy way to import animation keyframes directly from your CSS. You had to re-define them in JS, using a completely different format. So, I wrote a typed, spec-compliant library to convert. Along the way, I also added some other useful utilities for working with the API.
|
|
22
|
+
|
|
19
23
|
## Installation
|
|
20
24
|
|
|
21
25
|
::: code-group
|
|
@@ -68,9 +72,28 @@ await attachedAnim.finished;
|
|
|
68
72
|
```
|
|
69
73
|
[...and more.][2]
|
|
70
74
|
|
|
75
|
+
### Importing a stylesheet directly
|
|
76
|
+
|
|
77
|
+
Instead of getting an animation from the document's stylesheets, you can also import it directly from a CSS file.
|
|
78
|
+
|
|
79
|
+
```js
|
|
80
|
+
import KeyframeKit from 'keyframekit';
|
|
81
|
+
|
|
82
|
+
const styleSheet = await KeyframeKit.importStyleSheet('./styles.css');
|
|
83
|
+
|
|
84
|
+
// get animation keyframes from stylesheet
|
|
85
|
+
const rotateSmallAnimKeyframes = KeyframeKit.getStyleSheetKeyframes({
|
|
86
|
+
of: 'rotate-small',
|
|
87
|
+
in: styleSheet
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
> Note: `@import` rules won't be resolved in stylesheets imported in this way. [More info.][3]
|
|
92
|
+
|
|
71
93
|
### Defining animations in JS
|
|
72
94
|
|
|
73
|
-
|
|
95
|
+
The `KeyframeEffectParameters` class provides a more convenient way to define your animations in JS than is offered natively.
|
|
96
|
+
It's useful for when you want to have all your animation code in one place.
|
|
74
97
|
|
|
75
98
|
```js
|
|
76
99
|
import { KeyframeEffectParameters } from 'keyframekit';
|
|
@@ -101,24 +124,6 @@ const attachedAnim = linkTextHoverAnim.toAnimation({
|
|
|
101
124
|
attachedAnim.play();
|
|
102
125
|
```
|
|
103
126
|
|
|
104
|
-
### Importing a stylesheet directly
|
|
105
|
-
|
|
106
|
-
Instead of getting an animation from the document's stylesheets, you can also import it directly from a CSS file.
|
|
107
|
-
|
|
108
|
-
```js
|
|
109
|
-
import KeyframeKit from 'keyframekit';
|
|
110
|
-
|
|
111
|
-
const styleSheet = await KeyframeKit.importStyleSheet('./styles.css');
|
|
112
|
-
|
|
113
|
-
// get animation keyframes from stylesheet
|
|
114
|
-
const rotateSmallAnimKeyframes = KeyframeKit.getStyleSheetKeyframes({
|
|
115
|
-
of: 'rotate-small',
|
|
116
|
-
in: styleSheet
|
|
117
|
-
});
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
> Note: `@import` rules won't be resolved in stylesheets imported in this way. [More info.][3]
|
|
121
|
-
|
|
122
127
|
### Full reference
|
|
123
128
|
[See here.](/reference/index.md)
|
|
124
129
|
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keyframekit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Intuitive, powerful and performant tools for working with CSS animations in JavaScript.",
|
|
5
5
|
"main": "./dist/KeyframeKit.js",
|
|
6
6
|
"scripts": {
|
|
@@ -34,4 +34,4 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"typescript": "^5.9.3"
|
|
36
36
|
}
|
|
37
|
-
}
|
|
37
|
+
}
|