Skip to content

Commit 73b6b69

Browse files
committed
curves updated!
1 parent 09b56d3 commit 73b6b69

File tree

1 file changed

+32
-15
lines changed

1 file changed

+32
-15
lines changed

lib/vinyl/vinyl.dart

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,12 @@ class _TransformAppState extends State<TransformApp>
192192
// animController.forward();
193193
}
194194

195+
final SpringDescription spring = const SpringDescription(
196+
mass: 2,
197+
stiffness: 150,
198+
damping: 20,
199+
);
200+
195201
initAnimations() {
196202
animController = AnimationController(
197203
vsync: this, duration: const Duration(milliseconds: 1000))
@@ -208,19 +214,19 @@ class _TransformAppState extends State<TransformApp>
208214
// Combine vertical animations on the first Vinyl!
209215
_combinedVerticalAnimation = TweenSequence<double>([
210216
TweenSequenceItem(
211-
tween: Tween<double>(begin: 0.0, end: 120.0).chain(
212-
CurveTween(curve: Interval(0.0, 0.33, curve: Curves.linear))),
213-
weight: 33.0,
217+
tween: Tween<double>(begin: 0.0, end: 120.0)
218+
.chain(CurveTween(curve: Curves.linear)),
219+
weight: 35.0,
214220
),
215221
TweenSequenceItem(
216-
tween: Tween<double>(begin: 120.0, end: 120.0).chain(
217-
CurveTween(curve: Interval(0.33, 0.5, curve: Curves.linear))),
218-
weight: 17.0,
222+
tween: Tween<double>(begin: 120.0, end: 120.0)
223+
.chain(CurveTween(curve: Curves.linear)),
224+
weight: 30.0,
219225
),
220226
TweenSequenceItem(
221227
tween: Tween<double>(begin: 120.0, end: 0.0)
222-
.chain(CurveTween(curve: Interval(0.5, 1.0, curve: Curves.linear))),
223-
weight: 50.0,
228+
.chain(CurveTween(curve: Curves.linear)),
229+
weight: 35.0,
224230
),
225231
]).animate(animController);
226232

@@ -231,17 +237,17 @@ class _TransformAppState extends State<TransformApp>
231237
TweenSequenceItem(
232238
tween: Tween<double>(begin: 0.0, end: pi / 2)
233239
.chain(CurveTween(curve: Curves.linear)),
234-
weight: 25.0,
240+
weight: 40.0,
235241
),
236242
TweenSequenceItem(
237243
tween: Tween<double>(begin: pi / 2, end: 3 * pi / 2)
238244
.chain(CurveTween(curve: Curves.linear)),
239-
weight: 50.0,
245+
weight: 20.0,
240246
),
241247
TweenSequenceItem(
242248
tween: Tween<double>(begin: 3 * pi / 2, end: 2 * pi)
243249
.chain(CurveTween(curve: Curves.linear)),
244-
weight: 25.0,
250+
weight: 40.0,
245251
),
246252
]).animate(animController);
247253

@@ -252,23 +258,30 @@ class _TransformAppState extends State<TransformApp>
252258
),
253259
);
254260

261+
// final normalSpringOpen = SpringSimulation(spring, 0, 1, 1);
262+
// final normalSpringClose = SpringSimulation(spring, 1, 0, 1);
255263
_topJumpAnimation = TweenSequence<double>([
256264
TweenSequenceItem(
257265
tween: Tween<double>(begin: 0.0, end: -120)
266+
.chain(CurveTween(curve: Curves.easeOut)),
267+
weight: 30.0,
268+
),
269+
TweenSequenceItem(
270+
tween: Tween<double>(begin: -120, end: -120)
258271
.chain(CurveTween(curve: Curves.linear)),
259-
weight: 50.0,
272+
weight: 40.0,
260273
),
261274
TweenSequenceItem(
262275
tween: Tween<double>(begin: -120, end: 0.0)
263-
.chain(CurveTween(curve: Curves.linear)),
264-
weight: 50.0,
276+
.chain(CurveTween(curve: Curves.easeOut)),
277+
weight: 30.0,
265278
),
266279
]).animate(animController);
267280

268281
_topMoveForwardAnimation = Tween<double>(begin: 0.0, end: -50).animate(
269282
CurvedAnimation(
270283
parent: animController,
271-
curve: Interval(0.0, 1.0, curve: Curves.linear),
284+
curve: Interval(0.0, 0.3, curve: Curves.easeOut),
272285
),
273286
);
274287
}
@@ -364,3 +377,7 @@ final List<VinylItem> vinylItems = [
364377
];
365378

366379
final vinylOrder = ['vinyl_3', 'vinyl_2', 'vinyl_1'];
380+
381+
double degreesToRadians(double degrees) {
382+
return degrees * (pi / 180);
383+
}

0 commit comments

Comments
 (0)