@klex/mascot 0.2.1 → 0.3.0
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/package.json +2 -2
- package/src/activity.ts +14 -2
- package/src/css.d.ts +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@klex/mascot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "The animated Klex mascot: a React component, its GSAP motion engine, body presets, and SVG helpers.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT AND CC-BY-4.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"motion": "13.1.0",
|
|
54
54
|
"react": "19.2.8",
|
|
55
55
|
"react-dom": "19.2.8",
|
|
56
|
-
"typescript": "
|
|
56
|
+
"typescript": "7.0.2",
|
|
57
57
|
"vitest": "4.1.10"
|
|
58
58
|
},
|
|
59
59
|
"keywords": [
|
package/src/activity.ts
CHANGED
|
@@ -10,6 +10,7 @@ export const ACTIVITIES = [
|
|
|
10
10
|
{ id: 'sleeping', name: 'Sleeping' },
|
|
11
11
|
{ id: 'working', name: 'Working' },
|
|
12
12
|
{ id: 'calling', name: 'On a call' },
|
|
13
|
+
{ id: 'flying', name: 'Flying up' },
|
|
13
14
|
] as const;
|
|
14
15
|
export type KlexActivity = (typeof ACTIVITIES)[number]['id'];
|
|
15
16
|
|
|
@@ -34,6 +35,15 @@ function activityPose(activity: KlexActivity | false, time: number) {
|
|
|
34
35
|
lookY: 2,
|
|
35
36
|
};
|
|
36
37
|
}
|
|
38
|
+
if (activity === 'flying')
|
|
39
|
+
// Looks up and stretches toward where it is going, swaying a little.
|
|
40
|
+
return {
|
|
41
|
+
...REST_EMOTE,
|
|
42
|
+
compression: -0.06,
|
|
43
|
+
nod: -0.35,
|
|
44
|
+
headSway: 1.5 * Math.sin(phase * 3),
|
|
45
|
+
lookY: -7,
|
|
46
|
+
};
|
|
37
47
|
if (activity === 'calling')
|
|
38
48
|
return {
|
|
39
49
|
...REST_EMOTE,
|
|
@@ -51,7 +61,7 @@ export function createActivity() {
|
|
|
51
61
|
const idle = createIdle();
|
|
52
62
|
const working = createWorking();
|
|
53
63
|
const calling = createCalling();
|
|
54
|
-
const weights = { idle: 0, sleeping: 0, working: 0, calling: 0 };
|
|
64
|
+
const weights = { idle: 0, sleeping: 0, working: 0, calling: 0, flying: 0 };
|
|
55
65
|
let time = Math.random() * 6;
|
|
56
66
|
let laptopScale = 0;
|
|
57
67
|
let laptopVisible = false;
|
|
@@ -121,6 +131,7 @@ export function createActivity() {
|
|
|
121
131
|
const sleeping = activityPose('sleeping', time);
|
|
122
132
|
const workingPose = working.pose();
|
|
123
133
|
const callingPose = calling.pose();
|
|
134
|
+
const flying = activityPose('flying', time);
|
|
124
135
|
const pose = { ...REST_EMOTE };
|
|
125
136
|
for (const key of [
|
|
126
137
|
'compression',
|
|
@@ -136,7 +147,8 @@ export function createActivity() {
|
|
|
136
147
|
resting[key] +
|
|
137
148
|
sleeping[key] * weights.sleeping +
|
|
138
149
|
workingPose[key] * weights.working +
|
|
139
|
-
callingPose[key] * weights.calling
|
|
150
|
+
callingPose[key] * weights.calling +
|
|
151
|
+
flying[key] * weights.flying;
|
|
140
152
|
}
|
|
141
153
|
return pose;
|
|
142
154
|
},
|
package/src/css.d.ts
ADDED