Git Product home page Git Product logo

flutter-image-sequence-animator's People

Contributors

akindone avatar aliyigitbireroglu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

flutter-image-sequence-animator's Issues

Is it still working on Flutter 3.0.2?

I'm new to Flutter but I get HttpException: Invalid statusCode: 403.

ImageSequenceAnimator(
        'https://cdn2.doki1001.com/wp-content/uploads/WP-manga/data/manga_6149d88d66b2b/db5198634b8b7c462f3668bc3e72e3fb',
        '',
        0,
        2,
        'jpg',
        10,
        key: const Key('online'),
        fps: 3,
        isAutoPlay: true,
        isOnline: true,
        onReadyToPlay: onOnlineReadyToPlay,
        onPlaying: onOnlinePlaying,
      ),

Support for random named images

I love this package, its exactly what I need. But I have images in firebase storage where the names are generated and don't follow the naming format you have implemented. Is there a possibility for an implementation where the frames can be looped from a list of urls instead?

onFinishPlaying is being called twice

I am having a problem on my app where the init method is being called twice, after some tests I realized that onFinishPlyaing is being called twice, could you help me with that? Thank you.

ImageSequenceAnimator(
                                "assets/animation",
                                "frame_",
                                0,
                                0,
                                "png",
                                22,
                                fps: 20,
                                onFinishPlaying: (imageSequenceAnimatorState){

                                  print("onFinishPlaying");
                                  splashController.init();

                                },
                              ),

onFinishPlaying // it prints twice

flutter doctor -v

[✓] Flutter (Channel stable, 2.5.3, on macOS 11.6 20G165 darwin-arm, locale en-BR)
• Flutter version 2.5.3 at /Users/djalma/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 18116933e7 (7 weeks ago), 2021-10-15 10:46:35 -0700
• Engine revision d3ea636dc5
• Dart version 2.14.4

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/djalma/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• ANDROID_HOME = /Users/djalma/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 13.1, Build version 13A1030d
• CocoaPods version 1.10.2

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

[✓] Android Studio (version 2020.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 11.0.10+0-b96-7249189)

[✓] Connected device (3 available)
• iPad Pro (9.7-inch) (mobile) • 0C8AB907-97CE-4FD7-B4EC-A38A33242FDC • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-0 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 11.6 20G165 darwin-arm
• Chrome (web) • chrome • web-javascript • Google Chrome 96.0.4664.55

• No issues found!

Why is Color white chosen as default?

I have been struggling to find the reason why my sequence is not playing and nothing is shown. Later I realized that my background is white, and default color is also white, so I was not seeing anything. The default should just be null. Is there any reason that white is chosen?

Stable null-safety dependency

image_sequence_animator >=1.0.8 depends on cached_network_image ^2.3.3 and pmx_flutter depends on cached_network_image ^3.0.0-nullsafety

How is the totalTime calculated?

I have the following settings:

ImageSequenceAnimator(
                "assets/sequence",
                "",
                0,
                4,
                "png",
                30,
                key: Key("offline"),
                fullPaths: null,
                // color: color1,
                fps: 30,
                onReadyToPlay: onOfflineReadyToPlay,
                onPlaying: onOfflinePlaying,
              ),

I see a totalTime of 990. How can this be?
30 images * 30 frames is 900.

Animation not working on splash screen

I have been using this library for some time now, and it worked great. But recently I tried to add animation to splash screen - initial screen opens as splash screen and when animation ends I open another screen.

Animation works well when I run my app from computer. However, when I close and open the app from device, only single image is being shown and there is no animation. What can be the reason for this? Should I wait for some initialization?

Null error on reopening the activity

The animation works fine when I start the app. After I press back button and open the activity again I get Null error.

`import 'package:flutter/material.dart';

import 'package:flutter/cupertino.dart';

import 'package:image_sequence_animator/image_sequence_animator.dart';

class Image_Sequence_2 extends StatefulWidget {
Image_Sequence_2() : super();

@OverRide
CarouselHistory createState() => CarouselHistory();
}

class CarouselHistory extends State<Image_Sequence_2> {
ImageSequenceAnimatorState? get imageSequenceAnimator =>
offlineImageSequenceAnimator;
ImageSequenceAnimatorState? offlineImageSequenceAnimator;

bool wasPlaying = false;

bool _useFullPaths = true;
List? _fullPathsOffline;

void onOfflineReadyToPlay(ImageSequenceAnimatorState _imageSequenceAnimator) {
offlineImageSequenceAnimator = _imageSequenceAnimator;
}

void onOfflinePlaying(ImageSequenceAnimatorState _imageSequenceAnimator) {
setState(() {});
}

@OverRide
void dispose() {
super.dispose();
}

@OverRide
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey,
appBar: AppBar(
backgroundColor: Colors.black54,
title: const Text("Demo",
style: TextStyle(fontSize: 25.0, color: Colors.teal)),
centerTitle: true,
),
body: Container(
color: Colors.black54,
height: double.infinity,
alignment: Alignment.topCenter,
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Divider(
height: 20,
thickness: 5,
endIndent: 0,
color: Colors.black,
),
Container(
alignment: Alignment.center,
child: ImageSequenceAnimator(
"https://www.noorderlichtapp.nl",
"aurora_",
1,
1,
"jpg",
8,
key: Key("online"),
fps: 15,
isAutoPlay: false,
isOnline: true,
waitUntilCacheIsComplete: true,
cacheProgressIndicatorBuilder: (context, progress) {
return CircularProgressIndicator(
value: progress,
);
},
fullPaths: _useFullPaths ? _fullPathsOffline : null,
onReadyToPlay: onOfflineReadyToPlay,
onPlaying: onOfflinePlaying,
),
),
Container(
alignment: Alignment.center,
child: CupertinoSlider(
value: imageSequenceAnimator == null
? 0.0
: imageSequenceAnimator!.currentProgress,
min: 0.0,
max: imageSequenceAnimator == null
? 100.0
: imageSequenceAnimator!.totalProgress,
onChangeStart: (double value) {
wasPlaying = imageSequenceAnimator!.isPlaying;
imageSequenceAnimator!.pause();
},
onChanged: (double value) {
imageSequenceAnimator!.skip(value);
},
onChangeEnd: (double value) {
if (wasPlaying) imageSequenceAnimator!.play();
},
),
),
const Divider(
height: 20,
thickness: 5,
endIndent: 0,
color: Colors.black,
),
],
),
),
));
}
}
`

Many pictures will make it impossible to display

Many pictures will make it impossible to display

issue code branch【image-sequence-animator】

Flutter issue

issue code

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import 'package:spring_button/spring_button.dart';
import 'package:image_sequence_animator/image_sequence_animator.dart';

class HomePage extends StatefulWidget {
  HomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  ImageSequenceAnimatorState imageSequenceAnimator;
  bool wasPlaying = false;
  Color color1 = Colors.greenAccent;
  Color color2 = Colors.indigo;
  String loopText = "Start Loop";
  String boomerangText = "Start Boomerang";

  void onReadyToPlay(ImageSequenceAnimatorState _imageSequenceAnimator) {
    imageSequenceAnimator = _imageSequenceAnimator;
  }

  void onPlaying(ImageSequenceAnimatorState _imageSequenceAnimator) {
    setState(() {});
  }

  Widget row(String text, Color color) {
    return Padding(
      padding: EdgeInsets.all(3.125),
      child: Container(
        decoration: BoxDecoration(
          color: color,
          borderRadius: const BorderRadius.all(const Radius.circular(10.0)),
        ),
        child: Center(
          child: Text(
            text,
            style: const TextStyle(
              color: Colors.white,
              fontWeight: FontWeight.bold,
              fontSize: 12.5,
            ),
          ),
        ),
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text(widget.title)),
      body: Column(
        children: [
          Expanded(
            flex: 4,
            child: Padding(
              padding: EdgeInsets.all(25),
              child: ImageSequenceAnimator(
                "assets/images/side",
                "side_",
                0,
                0,
                "jpg",
                60,
                isAutoPlay: false,
                color: null,
                onReadyToPlay: onReadyToPlay,
                onPlaying: onPlaying,
              ),
            ),
          ),
          Expanded(
            child: Row(
              children: [
                Expanded(
                  flex: 4,
                  child: CupertinoSlider(
                    value: imageSequenceAnimator == null ? 0.0 : imageSequenceAnimator.animationController.value,
                    min: imageSequenceAnimator == null ? 0.0 : imageSequenceAnimator.animationController.lowerBound,
                    max: imageSequenceAnimator == null ? 100.0 : imageSequenceAnimator.animationController.upperBound,
                    onChangeStart: (double value) {
                      wasPlaying = imageSequenceAnimator.animationController.isAnimating;
                      imageSequenceAnimator.pause();
                    },
                    onChanged: (double value) {
                      imageSequenceAnimator.skip(value);
                    },
                    onChangeEnd: (double value) {
                      if (wasPlaying) imageSequenceAnimator.play();
                    },
                  ),
                ),
                Expanded(
                  child: Center(
                    child: Text(
                      imageSequenceAnimator == null ? "0.0" : ((imageSequenceAnimator.currentTime.floor()).toString() + "/" + (imageSequenceAnimator.totalTime.floor()).toString()),
                      textAlign: TextAlign.center,
                    ),
                  ),
                ),
              ],
            ),
          ),
          Expanded(
            child: Row(
              children: [
                Expanded(
                  child: SpringButton(
                    SpringButtonType.OnlyScale,
                    row(
                      loopText,
                      Colors.cyan,
                    ),
                    useCache: false,
                    onTap: () {
                      setState(() {
                        loopText = imageSequenceAnimator.isLooping ? "Start Loop" : "Stop Loop";
                        boomerangText = "Start Boomerang";
                        imageSequenceAnimator.setIsLooping(!imageSequenceAnimator.isLooping);
                      });
                    },
                  ),
                ),
                Expanded(
                  child: SpringButton(
                    SpringButtonType.OnlyScale,
                    row(
                      boomerangText,
                      Colors.deepPurpleAccent,
                    ),
                    useCache: false,
                    onTap: () {
                      setState(() {
                        loopText = "Start Loop";
                        boomerangText = imageSequenceAnimator.isBoomerang ? "Start Boomerang" : "Stop Boomerang";
                        imageSequenceAnimator.setIsBoomerang(!imageSequenceAnimator.isBoomerang);
                      });
                    },
                  ),
                ),
              ],
            ),
          ),
          Expanded(
            child: SpringButton(
              SpringButtonType.OnlyScale,
              row(
                "Change Colour",
                Colors.redAccent,
              ),
              useCache: false,
              onTap: () {
                imageSequenceAnimator.changeColor(imageSequenceAnimator.color == color1 ? color2 : color1);
              },
            ),
          ),
          Expanded(
            child: Row(
              children: [
                Expanded(
                  child: SpringButton(
                    SpringButtonType.OnlyScale,
                    row(
                      "Play/Pause",
                      Colors.deepOrangeAccent,
                    ),
                    useCache: false,
                    onTap: () {
                      setState(() {
                        imageSequenceAnimator.animationController.isAnimating ? imageSequenceAnimator.pause() : imageSequenceAnimator.play();
                      });
                    },
                  ),
                ),
                Expanded(
                  child: SpringButton(
                    SpringButtonType.OnlyScale,
                    row(
                      "Stop",
                      Colors.green,
                    ),
                    useCache: false,
                    onTap: () {
                      imageSequenceAnimator.stop();
                    },
                  ),
                ),
              ],
            ),
          ),
          Expanded(
            child: Row(
              children: [
                Expanded(
                  child: SpringButton(
                    SpringButtonType.OnlyScale,
                    row(
                      "Restart",
                      Colors.teal,
                    ),
                    useCache: false,
                    onTap: () {
                      imageSequenceAnimator.restart();
                    },
                  ),
                ),
                Expanded(
                  child: SpringButton(
                    SpringButtonType.OnlyScale,
                    row(
                      "Rewind",
                      Colors.indigoAccent,
                    ),
                    useCache: false,
                    onTap: () {
                      imageSequenceAnimator.rewind();
                    },
                  ),
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}

Pause and Unpause

Hi, I feel a bit stupid, but I can't get the animation to pause and unpause. Could you provide a simple implementation for this?
imgSequence.createState().pause();
dose not seem to work.`
Thank you.

[Feature Request] Parameter for number of times to play the animation

Need configuration like sequence plays as boomerang but not in the loop and only once.

Planned to use callbacks onPlaying and onFinishPlaying to manually stop it after 1 iteration but does not seem to be a nice solution.

Also, the issue is these callbacks are fired for every frame/image. So, onPlaying is called 64 times when I have 60 images.

ImageSequenceAnimator(
                "assets/images/newScrollSprites", //folderName
                "", //fileName
                1, //suffixStart
                1, //suffixCount
                "png", //fileFormat
                60, //frameCount
                // fps: 60,
                isBoomerang: true,
                isLooping: false,
                isAutoPlay: false,
                onReadyToPlay: onOfflineReadyToPlay,
                onPlaying: onOfflinePlaying,
                onFinishPlaying: onFinishPlaying,
 )

Parameter like "animationIterations" which respects boomerang property would help.

Using image sequence animator with Image.network

I really love this plugin, Im using it to create a "stop motion" from the lasted saved webcam screens. However these screens are all stored online and ofcourse updated every X minute.

I would really love to use this plugin, where I can give a set of network images, instead of giving a location for my image assets.

How to handle the digits of suffix in image name?

ImageSequenceAnimator(
                    "assets/img/fraisier/AnimatedImage1", //folderName
                    "R19I1-", //fileName
                    1, //suffixStart
                    13, //suffixCount
                    "jpg", //fileFormat
                    60, //frameCount
                    isAutoPlay: true,
                  )

My Images names look like this,

images/R19I1-01.jpg
images/R19I1-02.jpg

Unable to load asset: assets/img/fraisier/AnimatedImage1/R19I1-0000000000001.jpg
I am facing this issue!
Can you please tell me how to handle the digits of the name? Or is there any fix?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.