ShakeAnimationBuilder class
lib/demo/shake/shake_animation_builder.dart 抖动动画效果的 Builder
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- ShakeAnimationBuilder
Constructors
-
ShakeAnimationBuilder.new({required Widget child, required Animation<
double> animation, double randomValue = 5, ShakeAnimationType shakeAnimationType = ShakeAnimationType.RoateShake}) -
child
执行动画的组件animation
执行的动画
Properties
-
animation
→ Animation<
double> -
动画的定义
final
- child → Widget
-
执行动画的子Widget
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- random → Random
-
随机动画时使用构建随机数
final
- randomValue → double
-
随机动画时抖动的波动范围
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shakeAnimationType → ShakeAnimationType
-
抖动的类型
final
Methods
-
build(
BuildContext context) → Widget -
lib/demo/shake/shake_animation_builder.dart
override
-
buildMatrix4(
) → Matrix4 - lib/demo/shake/shake_animation_builder.dart 根据不同的模式来构建不同的矩阵变化
-
buildRandowMatrix4(
) → Matrix4 -
lib/demo/shake/shake_animation_builder.dart
构建随机变换的矩阵
animation.value
同时要适配旋转, Matrix4的旋转是使用弧度计算的,一般抖动使用 0.1左右的弧度微旋转即可 所以这时配置的animation.value
的取值范围建议使用-0.1,0.1
那么对于Matrix4的translationValues平移来讲是使用的逻辑像素-0.1,0.1
这个范围的变动对于平移无法有明显的抖动效果 所以在这里 对于平移来说使用的-1.5,1.5
就会有明显一点的抖动效果random.nextDouble()
这个方法的值范围为0.0-1.0
然后通过结合配置的randomValue抖动的波动范围 默认为 5 Matrix4平移范围为-1.5,6.5
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited