This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:motor/motor.dart'; | |
class My3DMotionConverter implements MotionConverter<Vector3> { | |
@override | |
List<double> normalize(Vector3 value) => [value.x, value.y, value.z]; | |
@override | |
Vector3 denormalize(List<double> values) => Vector3(values[0], values[1], values[2]); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:motor/motor.dart'; | |
MotionBuilder( | |
motion: MaterialSpringMotion.expressiveSpatialDefault, | |
value: const Offset(100, 100), | |
from: Offset.zero, | |
converter: OffsetMotionConverter(), | |
builder: (context, value, child) { | |
return Transform.translate( | |
offset: value, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:motor/motor.dart'; | |
MotionBuilder( | |
motion: CupertinoMotion.bouncy(), | |
value: const Offset(100, 100), | |
from: Offset.zero, | |
converter: OffsetMotionConverter(), | |
builder: (context, value, child) { | |
return Transform.translate( | |
offset: value, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:motor/motor.dart'; | |
SingleMotionBuilder( | |
motion: CupertinoMotion.bouncy(), | |
value: targetValue, // Changes trigger smooth spring animation | |
builder: (context, value, child) { | |
return Container( | |
width: value, | |
height: value, | |
color: Colors.blue, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:motor/motor.dart' | |
final customMaterial = MaterialSpringMotion( | |
damping: 0.8, | |
stiffness: 500, | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:motor/motor.dart'; | |
final customMotion = CupertinoMotion( | |
duration: Duration(milliseconds: 600), | |
bounce: 0.3, | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:motor/motor.dart'; | |
// Physics-based motion (natural, responsive) | |
final spring = CupertinoMotion.bouncy(); // Or `Motion.bouncySpring()` | |
final material = MaterialSpringMotion.standardSpatialDefault(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:motor/motor.dart' | |
AnimatedContainer( | |
duration: const Duration(milliseconds: 500), | |
curve: MotionCurve(spring: CupertinoMotion.bouncy, velocity: .3), | |
height: size, | |
width: size, | |
color: Colors.blue, | |
), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
impoart 'package:motor/motor.dart'; | |
// Duration-based motion (traditional Flutter approach) | |
final linear = Motion.linear(Duration(seconds: 1)); | |
final withCurve = Motion.curved(Duration(seconds: 1), Curves.easeInOut); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defaults write -g com.apple.SwiftUI.DisableSolarium -bool YES | |
defaults write com.apple.finder com.apple.SwiftUI.DisableSolarium -bool YES | |
defaults write com.apple.Preview com.apple.SwiftUI.DisableSolarium -bool YES | |
then restart or do these commands | |
killall finder | |
killall Preview |