create-anima 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/dist/index.js +29 -20
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -127,7 +127,7 @@ export default function App() {
127
127
  );
128
128
  }
129
129
  `,
130
- 'src/animation.ts': () => `import { defineAnimation, easeOut, easeBack, Screen } from '@it-compiles/anima';
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
- // Animate title
152
- t.tween(800, easeBack, (ctx, u) => {
153
- ctx.pin(title, 'center').to(Screen.at(0.5, 0.4), u);
154
- ctx.scale(title).from(0).to(1, u);
155
- ctx.opacity(title).from(0).to(1, u);
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
- // Animate subtitle after title
159
- t.tween(600, easeOut, (ctx, u) => {
160
- ctx.pin(subtitle, 'center').to(Screen.at(0.5, 0.55), u);
161
- ctx.opacity(subtitle).from(0).to(1, u);
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
- // Hold for a moment
165
- t.wait(1000);
172
+ // Hold for a moment
173
+ t.wait(1000);
166
174
 
167
- // Fade out
168
- t.tween(500, easeOut, (ctx, u) => {
169
- ctx.opacity(title).to(0, u);
170
- ctx.opacity(subtitle).to(0, u);
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
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-anima",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "create-anima": "./dist/index.js"