create-anima 0.1.0 → 0.1.2
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/dist/index.js +30 -21
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -115,7 +115,7 @@ export default function App() {
|
|
|
115
115
|
</div>
|
|
116
116
|
|
|
117
117
|
<div className="flex-1 overflow-hidden">
|
|
118
|
-
<AnimaPlayer animation={animation} controls autoPlay />
|
|
118
|
+
<AnimaPlayer animation={animation} controls autoPlay style={{ height: '100%' }} />
|
|
119
119
|
</div>
|
|
120
120
|
|
|
121
121
|
<RenderDialog
|
|
@@ -127,7 +127,7 @@ export default function App() {
|
|
|
127
127
|
);
|
|
128
128
|
}
|
|
129
129
|
`,
|
|
130
|
-
'src/animation.ts': () => `import { defineAnimation, easeOut,
|
|
130
|
+
'src/animation.ts': () => `import { defineAnimation, easeOut, overShoot, Screen } from '@it-compiles/anima';
|
|
131
131
|
|
|
132
132
|
export default defineAnimation((scene) => {
|
|
133
133
|
// Set background
|
|
@@ -137,37 +137,46 @@ export default defineAnimation((scene) => {
|
|
|
137
137
|
const title = scene.text('Hello, Anima!', {
|
|
138
138
|
size: 72,
|
|
139
139
|
color: '#ffffff',
|
|
140
|
-
font: 'system-ui',
|
|
140
|
+
font: '72px system-ui',
|
|
141
141
|
});
|
|
142
142
|
|
|
143
143
|
const subtitle = scene.text('Edit src/animation.ts to get started', {
|
|
144
144
|
size: 24,
|
|
145
145
|
color: '#888888',
|
|
146
|
-
font: 'system-ui',
|
|
146
|
+
font: '24px system-ui',
|
|
147
147
|
});
|
|
148
148
|
|
|
149
149
|
// Build timeline
|
|
150
150
|
return (t) => {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
151
|
+
t.seq(() => {
|
|
152
|
+
// Set initial state - everything invisible and scaled down
|
|
153
|
+
t.instant((ctx) => {
|
|
154
|
+
ctx.opacity(title).to(0, 1);
|
|
155
|
+
ctx.opacity(subtitle).to(0, 1);
|
|
156
|
+
ctx.scale(title).to(0.5, 1);
|
|
157
|
+
});
|
|
157
158
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
159
|
+
// Animate title - fade in and scale up
|
|
160
|
+
t.tween(800, overShoot, (ctx, u) => {
|
|
161
|
+
ctx.pin(title, 'center').to([Screen.centerX(), 300], u);
|
|
162
|
+
ctx.scale(title).to(1, u);
|
|
163
|
+
ctx.opacity(title).to(1, u);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// Animate subtitle - fade in below title
|
|
167
|
+
t.tween(600, easeOut, (ctx, u) => {
|
|
168
|
+
ctx.pin(subtitle, 'center').to([Screen.centerX(), 400], u);
|
|
169
|
+
ctx.opacity(subtitle).to(1, u);
|
|
170
|
+
});
|
|
163
171
|
|
|
164
|
-
|
|
165
|
-
|
|
172
|
+
// Hold for a moment
|
|
173
|
+
t.wait(1000);
|
|
166
174
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
175
|
+
// Fade out both
|
|
176
|
+
t.tween(500, easeOut, (ctx, u) => {
|
|
177
|
+
ctx.opacity(title).to(0, u);
|
|
178
|
+
ctx.opacity(subtitle).to(0, u);
|
|
179
|
+
});
|
|
171
180
|
});
|
|
172
181
|
};
|
|
173
182
|
});
|