A Java library that models spring dynamics and adds real world physics to your app.

Related tags

Animations rebound
Overview

Rebound

Build Status Android Arsenal

About

Rebound is a java library that models spring dynamics. Rebound spring models can be used to create animations that feel natural by introducing real world physics to your application.

Rebound is not a general purpose physics library; however, spring dynamics can be used to drive a wide variety of animations. The simplicity of Rebound makes it easy to integrate and use as a building block for creating more complex components like pagers, toggles, and scrollers.

For examples and usage instructions head over to:

facebook.github.io/rebound

If you are looking to build springy animations for the web, check out the Javascript version.

License

BSD License

For Rebound software

Copyright (c) 2013, Facebook, Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Comments
  • Update published rebound.js on npm

    Update published rebound.js on npm

    The version of rebound.js on npm has an outdated version of createSpring:

     createSpring: function() {
          var spring = new Spring(this);
          this.registerSpring(spring);
          return spring;
        },
    

    Instead of what is in the docs

    createSpring: function(tension, friction) {
          var spring = new Spring(this);
          this.registerSpring(spring);
          if (typeof tension === 'undefined' || typeof friction === 'undefined') {
            spring.setSpringConfig(SpringConfig.DEFAULT_ORIGAMI_SPRING_CONFIG);
          } else {
            var springConfig = SpringConfig.fromOrigamiTensionAndFriction(tension, friction);
            spring.setSpringConfig(springConfig);
          }
          return spring;
        },
    

    When following the example in the docs it throws an error since this._springConfig is never defined in the old version. *Great addition btw

    I would love to see rebound.js become it's own project with it's own repo etc. I have some performance improvements to add :)

    opened by kristoferjoseph 8
  • update gradle files to work with latest Android gradle plugin

    update gradle files to work with latest Android gradle plugin

    The Android Gradle plugin has changed a bit since the last commit to this project, so I've updated the various build scripts to use the newest version (since current Android Studio requires it).

    opened by MichaelEvans 5
  • SequencerSpring

    SequencerSpring

    @willbailey What do you think about a sequencer Spring? It's similar of SpringChain but without any interaction with another springs. Look like:

    SpringSquencer().create()
      .add(0, new Spring())
      .add(1, new Spring(), 1000)
      .add(2, new Spring());
    

    The first spring(at 0 index) will run, when this animation ends, it will run the second spring(at index 1) and wait 1000 miliseconds to run the spring at index 2.

    opened by ppamorim 4
  • SpringUtil question

    SpringUtil question

    Would you explain to me how to understand these params by your sample app

      // On each update of the spring value, we adjust the scale of the image view to match the
          // springs new value. We use the SpringUtil linear interpolation function mapValueFromRangeToRange
          // to translate the spring's 0 to 1 scale to a 100% to 50% scale range and apply that to the View
          // with setScaleX/Y. Note that rendering is an implementation detail of the application and not
          // Rebound itself. If you need Gingerbread compatibility consider using NineOldAndroids to update
          // your view properties in a backwards compatible manner.
          float mappedValue = (float) SpringUtil.mapValueFromRangeToRange(spring.getCurrentValue(), 0, 1, 1, 0.5);
    

    At the end, I would like to apply the spring's 0 to 1 to 400dp to 100 dp in the layout height. Please let me know how to apply it into SpringUtil.mapValueFromRangeToRange(spring.getCurrentValue(), 0, 1, 1, 0.5);. Thank you so much.

    opened by jjhesk 4
  • Remove Guava dependency

    Remove Guava dependency

    Guava is used for Preconditions and list/map utilities. There is no reason to force downstream consumers of this library to bundle a massive 2.1MB jar when you aren't even really using it.

    Preconditions is easily inlined since they amount to just an if+throw. The list and map utilities are easily replaced by instantiating lists and maps yourself and using Collections.unmodifiableFoo(new Foo(thing)) for defensive copies.

    I would have sent a pull request, but buck isn't on brew and didn't work with java 6, 7, or 8 on my system.

    opened by JakeWharton 4
  • Make samples apk available

    Make samples apk available

    Hi, I would like to be able to download the samples apk. I tried to compile the source code, but I just have the jdk 1.8 in my machine and #53 says it is not compatible with that..so, could you, please, make the samples apk available?

    opened by BugsBunnyBR 3
  • ConcurrentModificationException onRemoveListener

    ConcurrentModificationException onRemoveListener

    If you call the following consecutively it produces a Concurrent Exception, see the Stacktrace below.

    Seems that ReentrantCallback is not as safe as intended.

    mSpringFrom.addListener(new SimpleSpringListener() {
                @Override
                public void onSpringUpdate(final Spring spring) {
                    from.setTranslationX((float) spring.getCurrentValue());
                }
    
                @Override
                public void onSpringAtRest(final Spring spring) {
                    removeView(from);
                    mSpringFrom.removeListener(this);
                }
            });
    
    java.util.ConcurrentModificationException
                at java.util.HashMap$HashIterator.nextEntry(HashMap.java:806)
                at java.util.HashMap$KeyIterator.next(HashMap.java:833)
                at java.util.Collections$UnmodifiableCollection$1.next(Collections.java:960)
                at com.facebook.rebound.Spring.advance(Spring.java:402)
                at com.facebook.rebound.BaseSpringSystem.advance(BaseSpringSystem.java:138)
                at com.facebook.rebound.BaseSpringSystem.loop(BaseSpringSystem.java:159)
                at com.facebook.rebound.AndroidSpringLooperFactory$ChoreographerAndroidSpringLooper$1.doFrame(AndroidSpringLooperFactory.java:108)
                at android.view.Choreographer$CallbackRecord.run(Choreographer.java:759)
                at android.view.Choreographer.doCallbacks(Choreographer.java:574)
                at android.view.Choreographer.doFrame(Choreographer.java:543)
                at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
                at android.os.Handler.handleCallback(Handler.java:733)
                at android.os.Handler.dispatchMessage(Handler.java:95)
                at android.os.Looper.loop(Looper.java:136)
                at android.app.ActivityThread.main(ActivityThread.java:5017)
                at java.lang.reflect.Method.invokeNative(Native Method)
                at java.lang.reflect.Method.invoke(Method.java:515)
                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
                at dalvik.system.NativeStart.main(Native Method)
    
    bug 
    opened by chrisjenx 3
  • Who is using Rebound? : Inflikr For Flickr

    Who is using Rebound? : Inflikr For Flickr

    Hi,

    Just saw we can list app using rebound here. Inflikr is using it for some animations. Like here http://www.youtube.com/watch?v=a8A80I8S3fs#t=26

    Playstore link https://play.google.com/store/apps/details?id=kr.infli

    Thanks

    opened by eboudrant 3
  • Fix package.json

    Fix package.json

    • Add repository (fixes npm repo rebound)
    • Add bugs (fixes npm bugs rebound)
    • Add keywords (helps discoverability with npm search)
    • Add author
    • Add license
    opened by brianloveswords 3
  • Cannot build with Java 1.8

    Cannot build with Java 1.8

    Not sure if this is known, but installing Rebound using JDK 1.8u25 fails (both Playground and Example). It's weird because Gradle says the build succeeds until I try to push it to a device. JDK 1.7u75 has no issues, so I'm not too sure exactly what's going on. I don't see any specific build.gradle or settings.gradle files which specify a JDK version to build with either.

    Error occurs during preDexDebug:

    UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000) at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472) at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406) at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388) at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251) at com.android.dx.command.dexer.Main.processClass(Main.java:665) at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634) at com.android.dx.command.dexer.Main.access$600(Main.java:78) at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572) at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284) at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166) at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144) at com.android.dx.command.dexer.Main.processOne(Main.java:596) at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264) at com.android.dx.command.dexer.Main.run(Main.java:230) at com.android.dx.command.dexer.Main.main(Main.java:199) at com.android.dx.command.Main.main(Main.java:103) ...while parsing com/facebook/rebound/BaseSpringSystem.class

    opened by ekchang 2
  • Add ability to change the simulation speed for debugging purposes

    Add ability to change the simulation speed for debugging purposes

    This adds the ability to change the simulation speed for debugging purposes, and also the ability to change the simulation speed from the SpringConfiguratorView.

    opened by runningcode 2
  • Adding Code of Conduct file

    Adding Code of Conduct file

    This is pull request was created automatically because we noticed your project was missing a Code of Conduct file.

    Code of Conduct files facilitate respectful and constructive communities by establishing expected behaviors for project contributors.

    This PR was crafted with love by Facebook's Open Source Team.

    CLA Signed 
    opened by facebook-github-bot 0
  • Adding Contributing file

    Adding Contributing file

    This is pull request was created automatically because we noticed your project was missing a Contributing file.

    CONTRIBUTING files explain how a developer can contribute to the project - which you should actively encourage.

    This PR was crafted with love by Facebook's Open Source Team.

    CLA Signed 
    opened by facebook-github-bot 0
  • Project was not compiling on the latest version of Android Studio 3.3

    Project was not compiling on the latest version of Android Studio 3.3

    • Updated the following components:
    • Gradle wrapper from 2.2.1 to 4.10.1
    • Gradle version from 1.2.3 to 3.3.1
    • Added google() and jcenter() repositories instead of using mavenCentral()
    • Removed buildToolsVersion from .gradle files (no longer required)
    • Updated variant.javaCompile to variant.javaCompileProvider.get() (soon will be deprecated)
    • Updated compile to implementation (deprecated on latest gradle versions)
    • Removed uses-sdk tag from AndroidManifest (no longer required)
    • Added dependencie :rebound-core to example and playground in other to run these projects
    CLA Signed 
    opened by cmota 1
  • Possible defect in the source code

    Possible defect in the source code

    Hi.

    SpringOverScroller.java#L86-L87: getCurrVelocity

      public float getCurrVelocity() {
        double velX = mSpringX.getVelocity();
        double velY = mSpringX.getVelocity();
        return (int) Math.sqrt(velX * velX + velY * velY);
      }
    

    It is suspicious that the variables 'velX' and 'velY' are initialized with the same value.

    Probably, it should be:

      public float getCurrVelocity() {
        double velX = mSpringX.getVelocity();
        double velY = mSpringY.getVelocity();
        return (int) Math.sqrt(velX * velX + velY * velY);
      }
    

    This possible defect found by AppChecker.

    opened by AppChecker 0
Releases(v0.3.8)
Owner
Facebook Archive
These projects have been archived and are generally unsupported, but are still available to view and use
Facebook Archive
Android Animation Easing Functions. Let's make animation more real!

Android Easing Functions This project is originally from my another project, AndroidViewAnimation, which is an animation collection, to help you make

代码家 2.5k Jan 4, 2023
A Simple Todo app design in Flutter to keep track of your task on daily basis. Its build on BLoC Pattern. You can add a project, labels, and due-date to your task also you can sort your task on the basis of project, label, and dates

WhatTodo Life can feel overwhelming. But it doesn’t have to. A Simple To-do app design in flutter to keep track of your task on daily basis. You can a

Burhanuddin Rashid 1k Jan 1, 2023
Chandrasekar Kuppusamy 799 Nov 14, 2022
FadingToolbar is an animation library which fades out your footer view in a ScrollView/RecyclerView and fades in a toolbar title

FadingToolbar is an animation library which fades out your footer view in a ScrollView/RecyclerView and fades in a toolbar title (analogue of the LargeTitle animation in iOS)

Hanna 9 Nov 3, 2022
Introduction your app to the user , Easy to use and set Items as you want

Introduction App This lib helps to introduce the App-by view page based on Kotlin. Features Easy Set up Items: Title, Describe, Background, Buttons Ap

S.M.Zendehbad 0 May 6, 2022
Road Runner is a library for android which allow you to make your own loading animation using a SVG image

Road Runner Road Runner is a library for android which allow you to make your own loading animation using a SVG image Sample video View in Youtube Dem

Adrián Lomas 1.2k Nov 18, 2022
Android Annotation Processor library to generate adapter class easily from your model with a lot of customization

Android Annotation Processing Library to generate your adapters only with Annotations on your model, support working with Kapt and KSP Processors

Amr Hesham 63 Nov 24, 2022
ShimmerTextView is a simple library to integrate shimmer effect in your TextView.

ShimmerTextView ShimmerTextView is a simple library to integrate shimmer effect in your TextView. Key features Set a base color in ShimmerTextView. Se

MindInventory 22 Sep 7, 2022
A beautiful ripple animation for your app

Android Ripple Background A beautiful ripple animation for your app. You can easily change its color, speed of wave, one ripple or multiple ripples. S

Yao Yu 2.2k Dec 31, 2022
[] Easily have blurred and transparent background effect on your Android views.

##[DEPRECATED] BlurBehind Easily have blurred and transparent background effect on your Android views. Before API level 14 there was a Window flag cal

Gokberk Ergun 516 Nov 25, 2022
You don’t want your apps look and feel boring, do you? Add some bubbles!

#BubbleAnimationLayout Say hello to Bubble Animation Layout for Android by Cleveroad You don’t want your apps look and feel boring, do you? Add some b

Cleveroad 576 Nov 23, 2022
create your custom themes and change them dynamically with ripple animation

Android Animated Theme Manager create your custom themes and change them dynamically with ripple animation Features support java and kotlin projects.

Iman Dolatkia 601 Dec 22, 2022
Android StackBlur is a library that can perform a blurry effect on a Bitmap based on a gradient or radius, and return the result. The library is based on the code of Mario Klingemann.

Android StackBlur Android StackBlur is a library that can perform a blurry effect on a Bitmap based on a gradient or radius, and return the result. Th

Enrique López Mañas 3.6k Dec 29, 2022
:rocket: Ultimate Android Reference - Your Road to Become a Better Android Developer

The goal of this project is to provide a hand-picked collection of Android libraries, tools, open-source projects, books, blogs, tutorials - you name

Aritra Roy 7.6k Jan 4, 2023
Simple way to animate your views on Android with Rx 🚀

This is an Android library to make a simple way to animate your views on Android with Rx.

Lopez Mikhael 583 Dec 9, 2022
Animated-splash-screen - Animate your Splash Screen using Lottie files.

Animated Splash Screen This small project shows how you can add animation into your android projects or create beautiful looking Splash Screen or Laun

Aashish Ace 0 Jan 2, 2022
Postman is a reactive One-tap SMS verification library. This library allows the usage of RxJava with The SMS User Consent API

What is Postman? Postman is a reactive One-tap SMS verification library. This library allows the usage of RxJava with The SMS User Consent API Usage P

Cafer Mert Ceyhan 129 Dec 24, 2022
FilePicker is a small and fast file selector library that is constantly evolving with the goal of rapid integration, high customization, and configurability~

Android File Picker ??️ 中文简体 Well, it doesn't have a name like Rocky, Cosmos or Fish. Android File Picker, like its name, is a local file selector fra

null 786 Jan 6, 2023
EtsyBlur is an Android library that allows developers to easily add a glass-like blur effect implemented in the Etsy app.

EtsyBlur EtsyBlur is an Android library that allows developers to easily add a glass-like blur effect implemented in the past Etsy app. Try out the sa

Manabu S. 755 Dec 29, 2022