{"id":3487,"url":"https://github.com/UFreedom/FloatingView","last_synced_at":"2025-08-03T20:32:31.623Z","repository":{"id":85856618,"uuid":"71344792","full_name":"UFreedom/FloatingView","owner":"UFreedom","description":"FloatingView can make the target view floating above the anchor view with cool animation","archived":false,"fork":false,"pushed_at":"2019-05-24T13:32:03.000Z","size":1629,"stargazers_count":1816,"open_issues_count":3,"forks_count":247,"subscribers_count":44,"default_branch":"master","last_synced_at":"2024-11-21T12:47:56.896Z","etag":null,"topics":["android","animation","float-animation","floatingview"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/UFreedom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":["UFreedom"],"patreon":"UFreedom","open_collective":"Replace with a single Open Collective username","ko_fi":"UFreedom","tidelift":"UFreedom","custom":"https://qr.alipay.com/paipai/personal.htm"}},"created_at":"2016-10-19T10:13:21.000Z","updated_at":"2024-11-09T12:07:24.000Z","dependencies_parsed_at":"2023-03-02T22:30:13.092Z","dependency_job_id":null,"html_url":"https://github.com/UFreedom/FloatingView","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UFreedom%2FFloatingView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UFreedom%2FFloatingView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UFreedom%2FFloatingView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UFreedom%2FFloatingView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UFreedom","download_url":"https://codeload.github.com/UFreedom/FloatingView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228567009,"owners_count":17937983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","animation","float-animation","floatingview"],"created_at":"2024-01-05T20:16:42.890Z","updated_at":"2024-12-07T05:30:33.588Z","avatar_url":"https://github.com/UFreedom.png","language":"Java","readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://dribbble.com/shots/2583144-Aviate-Badge\" target=\"_blank\"\u003e\n  \u003cimg width=\"320\" height=\"240\" src=\"https://github.com/UFreedom/FloatingView/blob/master/images/floating_anim.gif\"\u003e\n  \u003c/a\u003e\n \u003c/p\u003e\n\n\u003ch3 align=\"center\"\u003eFloatingView\u003c/h3\u003e\n\n\u003cp align=\"center\"\u003e\n  FloatingView can make the target view  floating above the anchor view with cool animation\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca target=\"_blank\" href=\"https://github.com/UFreedom/FloatingView\"\u003e\u003cimg src=\"https://travis-ci.org/UFreedom/FloatingView.svg?branch=master\"\u003e\u003c/a\u003e\n\u003ca target=\"_blank\" href=\"https://bintray.com/ufreedom/maven/FloatingViewLibrary/_latestVersion\"\u003e\u003cimg src=\"https://api.bintray.com/packages/ufreedom/maven/FloatingViewLibrary/images/download.svg\"\u003e\u003c/a\u003e\n\u003ca target=\"_blank\" href='http://android-arsenal.com/details/1/4613'\u003e\u003cimg src='https://img.shields.io/badge/Android%20Arsenal-FloatingView-brightgreen.svg?style=flat'  /\u003e\u003c/a\u003e\n\u003ca target=\"_blank\" href=\"https://github.com/UFreedom/FloatingView\"\u003e\u003cimg src=\"https://img.shields.io/badge/android-3.0-brightgreen.svg\" \u003e\u003c/a\u003e\n\u003ca target=\"_blank\" href='https://github.com/UFreedom/FloatingView/blob/master/LICENSE.txt'\u003e\u003cimg src='https://img.shields.io/crates/l/rustc-serialize.svg'  /\u003e\u003c/a\u003e\n\n\u003c/p\u003e\n\n\u003c/br\u003e\u003c/br\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg  with=\"288\"  height=\"512\" src=\"https://github.com/UFreedom/FloatingView/blob/master/images/demo.gif\"\u003e\n\u003c/p\u003e\n\nLinks\n-----\n- [中文版 README](https://github.com/UFreedom/FloatingView/blob/master/README_CN.md)\n- [Blog about FloatingView](http://www.jianshu.com/p/6aaa258d77f1)\n- [demo.apk](http://oeapkptbn.bkt.clouddn.com/FloatingView-demo-v1.0.1.apk)\n\n\nUsage\n-----\n\n### Step 1\n\nAdd dependencies in build.gradle.\n\n```groovy\n    dependencies {\n        compile 'com.ufreedom.uikit:FloatingViewLib:1.0.2'\n    }\n\n```\n\n\n\n### Step 2\n\nUse FloatingBuilder to create a FloatingElement\n\n```java\n\n    FloatingElement builder = new FloatingBuilder()\n                            .anchorView(View)\n                            .targetView(View)\n                            .offsetX(int)\n                            .offsetY(int)\n                            .floatingTransition(FloatingTransition)\n                            .build();\n\n```\n\nThe use of FloatingBuilder can be configured to have：\n\n* anchorView ：Anchor, is you want to float animation in which View above\n* target：Target, The view which you want to float \n* offsetX：X direction of offset, unit PX\n* offsetY: Y direction of offset, unit PX\n* floatingTransition : Floating effect, the default is ScaleFloatingTransition\n\n\n### Step 3 \n\nCreate a Floating as a FloatingElement container, and then let your View fly up\n \n```java\n    Floating floating = new Floating(getActivity());\n    floating.startFloating(builder);\n```\n\n \nCustomisation\n-------------\n \n \n####1.Coordinates\n \n  \u003cimg src=\"http://oeapkptbn.bkt.clouddn.com/coordinate.png\" width=\"572\" height=\"427\"/\u003e\n \n \n####2.Class Diagram\n \n  \u003cimg src=\"http://oeapkptbn.bkt.clouddn.com/class_diagram.png\" width=\"831\" height=\"428\"/\u003e\n\n####3.Floating Animation \n\nImplementation of floating animation is very simple, you only need to implement the [FloatingTransition][4] interface.\n\n```java\n\n    public interface FloatingTransition {\n        public void applyFloating(YumFloating yumFloating);\n    }\n\n```\n\n\nIn the `applyFloating` method, you can use Android Animation to do the animation, and then use the [YumFloating][6] to do Alpha  , Scale, Translate, Rotate and other transformations.\nIf you want to add the [Facebook Rebound][5]  animation effect, you can use the [SpringHelper][7], for example, [ScaleFloatingTransition][8]:\n\n```java\n    public class ScaleFloatingTransition implements FloatingTransition {\n\n    ...\n    \n    @Override\n    public void applyFloating(final YumFloating yumFloating) {\n        \n        ValueAnimator alphaAnimator = ObjectAnimator.ofFloat(1.0f, 0.0f);\n        alphaAnimator.setDuration(duration);\n        alphaAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {\n            @Override\n            public void onAnimationUpdate(ValueAnimator valueAnimator) {\n                yumFloating.setAlpha((Float) valueAnimator.getAnimatedValue());\n            }\n        });\n        alphaAnimator.start();\n\n        SpringHelper.createWithBouncinessAndSpeed(0.0f, 1.0f,bounciness, speed)\n                .reboundListener(new SimpleReboundListener(){\n                    @Override\n                    public void onReboundUpdate(double currentValue) {\n                        yumFloating.setScaleX((float) currentValue);\n                        yumFloating.setScaleY((float) currentValue);\n                    }\n                }).start(yumFloating);\n    }\n    \n}\n\n\n```\n\nIf [SpringHelper][7] can not meet your needs, you can directly use the `createSpringByBouncinessAndSpeed(double bounciness, double speed)` or\n`createSpringByTensionAndFriction(double tension, double friction)` to create the Spring, and then use `transition (Progress double, startValue float, endValue float)` for numerical conversion\n \n####4.Floating Path Animation\nThe floating path animation is also very simple, such as [CurveFloatingPathTransition][9], first you need to inherit from the [BaseFloatingPathTransition][10] class ,The difference is, you need to implement a `getFloatingPath (`) method.\nUse `Path` in the `getFloatingPath () `method to create the path you want to float, and then call `FloatingPath.create (path, false)` to return. For example, [CurveFloatingPathTransition][9] implementation:\n\n```java\n    public class CurveFloatingPathTransition extends BaseFloatingPathTransition {\n\n        ...\n      \n        @Override\n        public FloatingPath getFloatingPath() {\n            if (path == null){\n                path = new Path();\n                path.moveTo(0, 0);\n                path.quadTo(-100, -200, 0, -300);\n                path.quadTo(200, -400, 0, -500);\n            }\n            return FloatingPath.create(path, false);\n        }\n\n        @Override\n        public void applyFloating(final YumFloating yumFloating) {\n            ValueAnimator translateAnimator;\n            ValueAnimator alphaAnimator;\n    \n            \n            translateAnimator = ObjectAnimator.ofFloat(getStartPathPosition(), getEndPathPosition());\n            translateAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {\n                @Override\n                public void onAnimationUpdate(ValueAnimator valueAnimator) {\n                    float value = (float) valueAnimator.getAnimatedValue();\n                    PathPosition floatingPosition = getFloatingPosition(value);\n                    yumFloating.setTranslationX(floatingPosition.x);\n                    yumFloating.setTranslationY(floatingPosition.y);\n    \n                }\n            });\n               \n           ...\n        }\n    \n}\n```\n\nUse Path to describe the path you want to float, and then in `applyFloating (YumFloating yumFloating)`:\n\n* Use `getStartPathPosition () ` method to obtain the starting position of the path\n* Use `getEndPathPosition () ` method to obtain the end position of the path\n* Use `getFloatingPosition(float progress)` to get the position of the current progress\n\n`getFloatingPosition(float progress)`method will return a `PathPosition` object, its properties x an y representing the current path animation x coordinates and Y coordinates.\n\n\n\nRelease Log\n-----------\n\n\n#### v1.0.2\n[Fix bug](https://github.com/UFreedom/FloatingView/pull/6)\n\n\n#### v1.0.1\nFirst Version\n\n\n\n\nLicense \n--------\n\n    Copyright 2015 UFreedom\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n\n\n[1]:https://github.com/UFreedom/FloatingView/blob/master/FloatingViewLib/src/main/java/com/ufreedom/floatingview/FloatingBuilder.java\n[2]:https://github.com/UFreedom/FloatingView/blob/master/FloatingViewLib/src/main/java/com/ufreedom/floatingview/FloatingElement.java\n[3]:https://github.com/UFreedom/FloatingView/blob/master/FloatingViewLib/src/main/java/com/ufreedom/floatingview/Floating.java\n[4]:https://github.com/UFreedom/FloatingView/blob/master/FloatingViewLib/src/main/java/com/ufreedom/floatingview/transition/FloatingTransition.java\n[5]:http://facebook.github.io/rebound/\n[6]:https://github.com/UFreedom/FloatingView/blob/master/FloatingViewLib/src/main/java/com/ufreedom/floatingview/transition/YumFloating.java\n[7]:https://github.com/UFreedom/FloatingView/blob/master/FloatingViewLib/src/main/java/com/ufreedom/floatingview/spring/SpringHelper.java\n[8]:https://github.com/UFreedom/FloatingView/blob/master/FloatingViewLib/src/main/java/com/ufreedom/floatingview/effect/ScaleFloatingTransition.java\n[9]:https://github.com/UFreedom/FloatingView/blob/master/FloatingViewLib/src/main/java/com/ufreedom/floatingview/effect/CurveFloatingPathTransition.java\n[10]:https://github.com/UFreedom/FloatingView/blob/master/FloatingViewLib/src/main/java/com/ufreedom/floatingview/transition/BaseFloatingPathTransition.java","funding_links":["https://github.com/sponsors/UFreedom","https://patreon.com/UFreedom","https://opencollective.com/Replace with a single Open Collective username","https://ko-fi.com/UFreedom","https://tidelift.com/funding/github/UFreedom","https://qr.alipay.com/paipai/personal.htm"],"categories":["Libraries","其他"],"sub_categories":["GUI"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FUFreedom%2FFloatingView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FUFreedom%2FFloatingView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FUFreedom%2FFloatingView/lists"}