Skip to content

[Impeller] Jittery glyphs when animating text transformation #149652

Closed

Description

@mrcendre

Steps to reproduce

  1. Run the sample code (wraps a Text widget within an animation-controlled Transform widget).

  2. Tap the text to trigger the scale animation and reproduce the issue.

Note: The issue can also reproduced with other Transfom type such as X/Y position. It can be reproduced with packages such as marquee (position animation) or bounce (scale and rotation animation).

Expected results

Spacing between glyphs should be constant across the entire animation, like when using Skia.

Actual results

Glyphs are jittering throughout the animation, making the spacing between glyphs inconsistent when animated.

The video recordings were taken on a physical iPhone XR because the issue was very noticeable on it.

@jonahwilliams IMHO, this looks very similar to some other typography issues (#140475, #138386 or #127815), which were fixed by flutter-team-archive/engine#53042 a few days ago. Although static text now looks great, unfortunately it did not fix this specific issue during animations. Maybe some kind of rounding error is remaining ?

@chinmaygarde This is the last issue preventing us from opting in to Impeller for our production apps — should it be part of Slimpeller's last blockers before opt-out is no longer supported ? (xref #144739, #144439)

Issues aside, Impeller is truly incredible and performance improvements are outstanding compared to the previous engine. It really does feel native, now. Thanks and congratulations to the Flutter teams for this amazing project!

Code sample

Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> with SingleTickerProviderStateMixin {
  late final controller = AnimationController(vsync: this, duration: const Duration(seconds: 2));

  TextStyle? get textStyle =>
      Theme.of(context).textTheme.headlineLarge?.copyWith(fontSize: 50.0, fontWeight: FontWeight.bold);

  bool isScaled = false;

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) => MaterialApp(
        debugShowCheckedModeBanner: false,
        theme: ThemeData(colorScheme: ColorScheme.fromSeed(seedColor: const Color(0xffffffff))),
        home: Scaffold(
          body: GestureDetector(
            onTap: _onTap,
            child: Center(
              child: AnimatedBuilder(
                  animation: controller,
                  builder: (_, child) => Transform.scale(
                        scale: 0.7 + (CurvedAnimation(parent: controller, curve: Curves.easeInOutCubic).value * 0.3),
                        child: child,
                      ),
                  child: Center(child: Text('Large headline', style: textStyle))),
            ),
          ),
        ),
      );

  void _onTap() => setState(() {
        isScaled = !isScaled;
        if (isScaled) {
          controller.forward();
        } else {
          controller.reverse();
        }
      });
}

Screenshots or Video

Screenshots / Video demonstration

IMPORTANT NOTE: Please watch the videos in fullscreen, as the small web viewport causes an overall aliasing effect which makes the difference almost un-noticeable. Ideally, you can open it in your native video player.

Skia ✅ Impeller ⛔
Skia.mov
Impeller.mov

Logs

Logs

Flutter Doctor output

Doctor output
[✓] Flutter (Channel master, 3.23.0-13.0.pre.87, on macOS 14.5 23F79 darwin-arm64, locale en)
    • Flutter version 3.23.0-13.0.pre.87 on channel master at /Users/redacted/Documents/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision c246ecdf8e (8 hours ago), 2024-06-03 18:06:22 -0700
    • Engine revision a6aa5d8266
    • Dart version 3.5.0 (build 3.5.0-218.0.dev)
    • DevTools version 2.36.0

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/redacted/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/redacted/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)

[✓] VS Code (version 1.89.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.90.0

[✓] Connected device (5 available)            
    • iPhone de Dev (mobile)          • redacted • ios            • iOS 17.4.1 21E236
    • macOS (desktop)                 • macos                     • darwin-arm64   • macOS 14.5 23F79 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad     • darwin         • macOS 14.5 23F79 darwin-arm64
    • Chrome (web)                    • chrome                    • web-javascript • Google Chrome 125.0.6422.141

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Activity

  1. darshankawar commented on Jun 4, 2024

    @darshankawar
    Member

    Thanks for the report. I was able to replicate this on latest master and stable version with impeller.

    stable, master flutter doctor -v
    [!] Flutter (Channel stable, 3.22.1, on macOS 12.2.1 21D62 darwin-x64, locale
        en-GB)
        • Flutter version 3.22.1 on channel stable at
          /Users/dhs/documents/fluttersdk/flutter
        ! Warning: `flutter` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside
          your current Flutter SDK checkout at
          /Users/dhs/documents/fluttersdk/flutter. Consider adding
          /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path.
        ! Warning: `dart` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your
          current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter.
          Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front
          of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision a14f74ff3a (12 days ago), 2024-05-22 11:08:21 -0500
        • Engine revision 55eae6864b
        • Dart version 3.4.1
        • DevTools version 2.34.3
        • If those were intentional, you can disregard the above warnings; however
          it is recommended to use "git" directly to perform update checks and
          upgrades.
    
    [!] Xcode - develop for iOS and macOS (Xcode 12.3)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        ! Flutter recommends a minimum Xcode version of 13.
          Download the latest version or update via the Mac App Store.
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] VS Code (version 1.62.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.21.0
    
    [✓] Connected device (5 available)
        • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
        • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
          ios            • iOS 14.4.1 18D61
        • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
          ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
        • macOS (desktop)            • macos                                    •
          darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
        • Chrome (web)               • chrome                                   •
          web-javascript • Google Chrome 98.0.4758.80
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    ! Doctor found issues in 1 category.
    
    [!] Flutter (Channel master, 3.23.0-13.0.pre.69, on macOS 12.2.1 21D62
        darwin-x64, locale en-GB)
        • Flutter version 3.23.0-13.0.pre.69 on channel master at
          /Users/dhs/documents/fluttersdk/flutter
        ! Warning: `flutter` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside
          your current Flutter SDK checkout at
          /Users/dhs/documents/fluttersdk/flutter. Consider adding
          /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path.
        ! Warning: `dart` on your path resolves to
          /Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your
          current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter.
          Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front
          of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 124aacbaef (2 days ago), 2024-05-31 22:32:25 -0400
        • Engine revision d81edf635a
        • Dart version 3.5.0 (build 3.5.0-214.0.dev)
        • DevTools version 2.36.0
        • If those were intentional, you can disregard the above warnings; however
          it is recommended to use "git" directly to perform update checks and
          upgrades.
    
    [!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
        • Android SDK at /Users/dhs/Library/Android/sdk
        ✗ cmdline-tools component is missing
          Run `path/to/sdkmanager --install "cmdline-tools;latest"`
          See https://developer.android.com/studio/command-line for more details.
        ✗ Android license status unknown.
          Run `flutter doctor --android-licenses` to accept the SDK licenses.
          See https://flutter.dev/docs/get-started/install/macos#android-setup for
          more details.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 13C100
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] IntelliJ IDEA Ultimate Edition (version 2021.3.2)
        • IntelliJ at /Applications/IntelliJ IDEA.app
        • Flutter plugin version 65.1.4
        • Dart plugin version 213.7228
    
    [✓] VS Code (version 1.62.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.29.0
    
    [✓] Connected device (3 available)
        • Darshan's iphone (mobile) • 21150b119064aecc249dfcfe05e259197461ce23 • ios
          • iOS 15.3.1 19D52
        • macOS (desktop)           • macos                                    •
          darwin-x64     • macOS 12.2.1 21D62 darwin-x64
        • Chrome (web)              • chrome                                   •
          web-javascript • Google Chrome 109.0.5414.119
    
    [✓] Network resources
        • All expected network resources are available.
    
    ! Doctor found issues in 1 category.
          
    [!] Xcode - develop for iOS and macOS (Xcode 12.3)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        ! Flutter recommends a minimum Xcode version of 13.
          Download the latest version or update via the Mac App Store.
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] VS Code (version 1.62.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.21.0
    
    [✓] Connected device (5 available)
        • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
        • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
          ios            • iOS 14.4.1 18D61
        • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
          ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
        • macOS (desktop)            • macos                                    •
          darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
        • Chrome (web)               • chrome                                   •
          web-javascript • Google Chrome 98.0.4758.80
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    ! Doctor found issues in 1 category.
    
    
    
    
  2. added
    engineflutter/engine related. See also e: labels.
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    e: impellerImpeller rendering backend issues and features requests
    and removed
    in triagePresently being triaged by the triage team
    on Jun 4, 2024
  3. self-assigned this
    on Jun 4, 2024
  4. moved this from Needs Triage to Blockers in Slimpelleron Jun 4, 2024
  5. jonahwilliams commented on Jun 5, 2024

    @jonahwilliams
    Contributor

    This is definitely jitterier in Impeller than Skia, so we could probaly do a bit better here. After fixing all of the other text bugs I have to say I don't really have it in me to take on another one this quarter, so I'd kick this one over to @bdero or @chinmaygarde .

    @mrcendre Aside from fixing this, the transformation is still slightly jumpy in Skia too: since you're essentially resizing the font you will hit different breakpoints that change the apparent size. Setting a filter quality on the transformation will scale the rasterized text instead of the text size, which should look better on all platforms and renderers.

  6. 63 remaining items

  7. moved this from Blockers to Done in Slimpelleron Feb 7, 2025
  8. added
    r: fixedIssue is closed as already fixed in a newer version
    on Feb 10, 2025
  9. github-actions commented on Feb 24, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  10. locked as resolved and limited conversation to collaborators on Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work liste: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.found in release: 3.22Found to occur in 3.22found in release: 3.23Found to occur in 3.23has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionslimpellerEngine binary size reduction. go/slimpellerteam-engineOwned by Engine teamtriaged-engineTriaged by Engine team

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions