Giter Club home page Giter Club logo

flutter-kenburns's Introduction

KenBurns

The Ken Burns effect is a type of panning and zooming effect used in video production from still imagery.

Wrap your image with a KenBurns widget

Container(
      height: 300,
      child: KenBurns(
        child: Image.network("https://lemag.nikonclub.fr/wp-content/uploads/2017/07/08.jpg", fit: BoxFit.cover,),
      ),
),

screen

Configuration

You can configure KenBurns Widget

KenBurns(
    minAnimationDuration : Duration(milliseconds: 3000),
    maxAnimationDuration : Duration(milliseconds: 10000),
    maxScale : 8,
    child: ...
  });

Multiple images

You can display multiple child in KenBurns with a CrossFade animation

Container(
    height: 300,
    child: KenBurns.multiple(
      childLoop: 3,
      children: [
        Image.network(
          "https://www.photo-paysage.com/?file=pic_download_link/picture&pid=3100",
          fit: BoxFit.cover,
        ),
        Image.network(
          "https://cdn.getyourguide.com/img/location_img-59-1969619245-148.jpg",
          fit: BoxFit.cover,
        ),
        Image.network(
          "https://www.theglobeandmail.com/resizer/vq3O7LI3hvsjTP2N0m9NwU4W3Eg=/1500x0/filters:quality(80)/arc-anglerfish-tgam-prod-tgam.s3.amazonaws.com/public/4ETF3GZR3NA3RDDW23XDRBKKCI",
          fit: BoxFit.cover,
        ),
      ],
    ),
),

Download

pub package

dependencies:
  kenburns: ^1.0.5

License

Copyright 2019 florent37, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

flutter-kenburns's People

Contributors

bringthechill avatar florent37 avatar sanekyy 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

Watchers

 avatar  avatar  avatar

flutter-kenburns's Issues

_KenBurnsState didn't handle widget update when number of children change

Number of children change from 6 to 3 and RangeError appear

I/flutter (12049): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (12049): The following RangeError was thrown building LayoutBuilder:
I/flutter (12049): RangeError (index): Invalid value: Not in inclusive range 0..2: 6
I/flutter (12049): 
I/flutter (12049): The relevant error-causing widget was:
I/flutter (12049):   LayoutBuilder
I/flutter (12049):   file:///Users/yuriy.dorofeev/.pub-cache/hosted/pub.dartlang.org/kenburns-1.0.4/lib/kenburns.dart:301:12
I/flutter (12049): 
I/flutter (12049): When the exception was thrown, this was the stack:
I/flutter (12049): #0      List.[] (dart:core-patch/growable_array.dart:177:60)
I/flutter (12049): #1      _KenBurnsState._buildChild (package:kenburns/kenburns.dart:330:35)

I fixed it in PR #6 .

_KenBurnsState didn't handle widget update

If parent/holder of KenBurns widget will change single to multiple or vise versa there will be some errors related with animation loops and missed handling of widget update.

single -> multiple:

#0      List.[] (dart:core-patch/growable_array.dart:177:60)
#1      _KenBurnsState._buildChild (package:kenburns/kenburns.dart:313:63)
#2      _KenBurnsState.build.<anonymous closure> (package:kenburns/kenburns.dart:296:20)

multiple -> single

NoSuchMethodError: The method '%' was called on null. Receiver: null Tried calling: %()
_KenBurnsState.fire (_KenBurnsState.java:259)

I fixed it in PR #5.

License?

Very nice! Thanks for sharing this. What license is applicable?

Images getting out from the view.

started showing white background while changing position.
KenBurns.multiple(
minAnimationDuration: Duration(milliseconds: 3000),
maxAnimationDuration: Duration(milliseconds: 5000),

          maxScale: 1.5,
          children: [
            Image.asset(
              'assets/img/girl.png',
              fit: BoxFit.cover,
            ),
            Image.asset(
              'assets/img/SliderLogin2.png',
              fit: BoxFit.cover,
            ),
            Image.asset(
              'assets/img/SliderLogin3.png',
              fit: BoxFit.cover,
            ),
            Image.asset(
              'assets/img/SliderLogin4.png',
              fit: BoxFit.cover,
            ),
          ],
        ),

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.