public static BitmapAnimationBackend createColorBitmapAnimationBackend(
      final int[] colors, final int animationDurationMs, final BitmapFrameCache bitmapFrameCache) {
    final PlatformBitmapFactory platformBitmapFactory =
        Fresco.getImagePipelineFactory().getPlatformBitmapFactory();
    final BitmapFrameRenderer bitmapFrameRenderer = new ColorAndFrameNumberRenderer(colors);
    final AnimationInformation animationInformation =
        new ColorListAnimationInformation(colors, animationDurationMs);
    final ExecutorService executorServiceForFramePreparer =
        new DefaultSerialExecutorService(
            new DefaultExecutorSupplier(
                    1,
                    DefaultExecutorSupplier.DEFAULT_NUM_IO_BOUND_THREADS,
                    DefaultExecutorSupplier.DEFAULT_NUM_LIGHTWEIGHT_BACKGROUND_THREADS)
                .forDecode());
    final BitmapFramePreparationStrategy framePreparationStrategy =
        new FixedNumberBitmapFramePreparationStrategy(NUMBER_OF_FRAMES_TO_PREPARE);
    final BitmapFramePreparer bitmapFramePreparer =
        new DefaultBitmapFramePreparer(
            platformBitmapFactory,
            bitmapFrameRenderer,
            Bitmap.Config.ARGB_8888,
            executorServiceForFramePreparer);

    BitmapAnimationBackend bitmapAnimationBackend =
        new BitmapAnimationBackend(
            platformBitmapFactory,
            bitmapFrameCache,
            animationInformation,
            bitmapFrameRenderer,
            false,
            framePreparationStrategy,
            bitmapFramePreparer,
            null);

    bitmapAnimationBackend.setFrameListener(new DebugBitmapAnimationFrameListener());
    return bitmapAnimationBackend;
  }
Bitmap animation factory to create backends for the sample app.
samples/animation2/src/main/java/com/facebook/samples/animation2/bitmap/ExampleBitmapAnimationFactory.java