Skip to content

Commit 4a43047

Browse files
committed
Merge branch 'main-github' into feature-composite-effects
# Conflicts: # lib/effects/shake_effect.dart
2 parents b4463a8 + 9e7dfcb commit 4a43047

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [2.0.1] - 2022-10-30
8+
### Changed
9+
- fixed `ShakeEffect.hz` calculations and adjusted defaults
10+
711
## [2.0.0] - 2022-10-23
812
### Added
913
- effects now use "smart" parameters. See README: Other Effect Parameters

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ packages:
6161
path: ".."
6262
relative: true
6363
source: path
64-
version: "2.0.0"
64+
version: "2.0.1"
6565
flutter_lints:
6666
dependency: "direct dev"
6767
description:

lib/effects/shake_effect.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,24 @@ import '../flutter_animate.dart';
88
/// The `hz` parameter indicates approximately how many times to repeat the shake
99
/// per second.
1010
///
11-
/// Defaults to a 5 degree (`pi / 36`) shake, 12 times per second — equivalent to:
11+
/// Defaults to a 5 degree (`pi / 36`) shake, 8 times per second — equivalent to:
1212
///
1313
/// ```
1414
/// Text("Hello").animate()
15-
/// .shake(hz: 12, rotation: pi / 36)
15+
/// .shake(hz: 8, rotation: pi / 36)
1616
/// ```
1717
///
1818
/// There are also shortcut extensions for applying horizontal / vertical shake.
19-
/// For example, this would shake 10 pixels horizontally (default is 6):
19+
/// For example, this would shake 10 pixels horizontally (default is 5):
2020
///
2121
/// ```
2222
/// Text("Hello").animate().shakeX(amount: 10)
2323
/// ```
2424
@immutable
2525
class ShakeEffect extends BeginEndEffect<double> {
26-
static const int defaultHz = 10;
26+
static const int defaultHz = 8;
2727
static const double defaultRotation = pi / 36;
28-
static const double defaultMove = 6;
28+
static const double defaultMove = 5;
2929

3030
const ShakeEffect({
3131
Duration? delay,
@@ -61,7 +61,7 @@ class ShakeEffect extends BeginEndEffect<double> {
6161
if (!shouldRotate && !shouldTranslate) return child;
6262

6363
final Animation<double> animation = buildAnimation(controller, entry);
64-
final int count = (entry.duration.inSeconds * hz).floor();
64+
final int count = (entry.duration.inMilliseconds / 1000 * hz).round();
6565

6666
return getOptimizedBuilder<double>(
6767
animation: animation,

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_animate
22
description: Add beautiful animated effects & builders in Flutter, via an easy, customizable, unified API.
3-
version: 2.0.0
3+
version: 2.0.1
44
repository: https://github.com/gskinner/flutter_animate
55
issue_tracker: https://github.com/gskinner/flutter_animate/issues
66

0 commit comments

Comments
 (0)