Created
October 18, 2025 19:05
-
-
Save fredgrott/dfd9cb8ece571abe648fc9c960503222 to your computer and use it in GitHub Desktop.
motor, motionconverter custom
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]); | |
} | |
Widget build(BuildContext context) { | |
return MotionBuilder( | |
motion: CupertinoMotion.bouncy(), | |
value: Vector3(100, 100, 100), | |
converter: My3DMotionConverter(), | |
// ... | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment