{"id":13644386,"url":"https://github.com/UFreedom/FloatingText","last_synced_at":"2025-04-21T07:31:12.918Z","repository":{"id":85856616,"uuid":"54539590","full_name":"UFreedom/FloatingText","owner":"UFreedom","description":"[DEPRECATED]  FloatingText is a text widget that can floating above view with animation","archived":false,"fork":false,"pushed_at":"2016-11-07T03:35:22.000Z","size":4057,"stargazers_count":704,"open_issues_count":5,"forks_count":109,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-04-05T03:11:09.484Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"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":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-03-23T07:28:34.000Z","updated_at":"2024-10-26T05:06:54.000Z","dependencies_parsed_at":"2023-03-05T02:00:18.056Z","dependency_job_id":null,"html_url":"https://github.com/UFreedom/FloatingText","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UFreedom%2FFloatingText","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UFreedom%2FFloatingText/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UFreedom%2FFloatingText/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UFreedom%2FFloatingText/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UFreedom","download_url":"https://codeload.github.com/UFreedom/FloatingText/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250014621,"owners_count":21360983,"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":[],"created_at":"2024-08-02T01:02:02.427Z","updated_at":"2025-04-21T07:31:07.905Z","avatar_url":"https://github.com/UFreedom.png","language":"Java","readme":"# DEPRECATED\n\nI have developed the [FloatingView](https://github.com/UFreedom/FloatingView) ,FloatingView can make the target view floating above the anchor view with cool animation.FloatingText do the same thing, FloatingView can do, and FloatingView more convenient and powerful.so you can use FloatingView instead of FloatingText.\n \n\n# FloatingText\n\n[![Build Status](https://travis-ci.org/UFreedom/FloatingText.svg?branch=master)](https://travis-ci.org/UFreedom/FloatingText) [ [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-FloatingText-green.svg?style=true)](https://android-arsenal.com/details/1/3360) ![Download](https://api.bintray.com/packages/ufreedom/maven/FloatingTextLibrary/images/download.svg) ](https://bintray.com/ufreedom/maven/FloatingTextLibrary/_latestVersion)\n\n\nFloatingText is a text widget that can floating above view with animation .\n\nNow we have 'Scale Floating','Scale Floating','Curve Floating',and you can also design custom a animation.\n\n[中文说明](https://github.com/UFreedom/FloatingText/blob/master/README_CN.md)\n\n\n\u003cimg src=\"/demo.gif\" width=\"270\" height=\"480\" /\u003e\n\n# Compatibility ![Requirements](https://img.shields.io/badge/Requirements-Android%203.0%2B-green.svg)\n\n  * Library - Android Honeycomb 3.0+\n  * Sample - Android Honeycomb 3.0+\n\n\n## Usage:\n\n1.Add Snapshot repository and add to dependencies:\n\n```groovy\ndependencies {\n\n     compile 'com.ufreedom.uikit:FloatingTextLibrary:0.2.0'\n}\n\n```\n\n2. Use FloatingText.FloatingTextBuilder to create a FloatingText：\n\n```java\n FloatingText   floatingText = new FloatingText.FloatingTextBuilder(Activity)\n                               .textColor(Color.RED) // floating  text color\n                               .textSize(100)   // floating  text size\n                               .textContent(\"+1000\") // floating  text content\n                               .offsetX(100) // the x offset  relate to the attached view\n                               .offsetY(100) // the y offset  relate to the attached view  \n                               .floatingAnimatorEffect(FloatingAnimator) // floating animation\n                               .floatingPathEffect(FloatingPathEffect) // floating path\n                               .build();\n\nfloatingText.attach2Window(); // let FloatingText attached to the Window\n```\n\n3.Start floating\n\n```java\nfloatingText.startFloating(View); // FloatingText do floating animation relate to the view\n```\n\n\n\n## Customisation:\n\n#### 1.Coordinates\n\n \u003cimg src=\"/coordinates.png\" width=\"423\" height=\"419\"/\u003e\n\n\n\n#### 2.Floating Animation\n\n Implements `FloatingAnimator` interface and do animation in the `applyFloatingAnimation` method：\n\n```java\npublic interface FloatingAnimator {\n     public void applyFloatingAnimation(FloatingTextView view);\n}\n```\n\n**[ReboundFloatingAnimator](https://github.com/UFreedom/FloatingText/blob/master/FloatingTextLibrary%2Fsrc%2Fmain%2Fjava%2Fcom%2Fufreedom%2Feffect%2FReboundFloatingAnimator.java)**\n\n`ReboundFloatingAnimator` implements FloatingAnimator and support rebound animation.The rebound animation is  Facebook's library [Rebound](https://github.com/facebook/rebound)。\n\nThere are  three help methods;\n\n- `createSpringByBouncinessAndSpeed` : config rebound  width bounciness and speed\n- `createSpringByTensionAndFriction` : config rebound  width tension and friction\n- `transition(float progress, float startValue, float endValue)`: use the method to get animated value .\n\nprogress : the progress of current animation\nstartValue : the start value of your animation\nendValue : the end value of your animation\n\nIn this library : [ScaleFloatingAnimator](https://github.com/UFreedom/FloatingText/blob/master/FloatingTextLibrary%2Fsrc%2Fmain%2Fjava%2Fcom%2Fufreedom%2Feffect%2FScaleFloatingAnimator.java)  ，[TranslateFloatingAnimator](https://github.com/UFreedom/FloatingText/blob/master/FloatingTextLibrary%2Fsrc%2Fmain%2Fjava%2Fcom%2Fufreedom%2Feffect%2FTranslateFloatingAnimator.java)，[BaseFloatingPathAnimator](https://github.com/UFreedom/FloatingText/blob/master/FloatingTextLibrary%2Fsrc%2Fmain%2Fjava%2Fcom%2Fufreedom%2FBaseFloatingPathAnimator.java) all implements `ReboundFloatingAnimator` interface。\n\nFor example : `ScaleFloatingAnimator`\n\n```java\npublic class ScaleFloatingAnimator extends ReboundFloatingAnimator {\n\n    public long duration;\n    public ScaleFloatingAnimator() {\n        duration = 1000;\n    }\n\n    public ScaleFloatingAnimator(long duration) {\n        this.duration = duration;\n    }\n\n    @Override\n    public void applyFloatingAnimation(final FloatingTextView view) {\n        Spring scaleAnim = createSpringByBouncinessAndSpeed(10, 15)\n                .addListener(new SimpleSpringListener() {\n                    @Override\n                    public void onSpringUpdate(Spring spring) {\n                        float transition = transition((float) spring.getCurrentValue(), 0.0f, 1.0f);\n                        view.setScaleX(transition);\n                        view.setScaleY(transition);\n                    }\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                view.setAlpha((Float) valueAnimator.getAnimatedValue());\n            }\n        });\n        scaleAnim.setEndValue(1f);\n        alphaAnimator.start();\n    }\n\n}\n```\n\n#### 3.Floating Path\n\nImplements `FloatingPathEffect` and `FloatingPathAnimator` interface can custom you own floating path animation.\n\n- `FloatingPath` is the floating path\n\n```java\npublic interface FloatingPathEffect {\n\n    abstract FloatingPath getFloatingPath(FloatingTextView floatingTextView);\n\n}\n```\n\ncreate a path  and then  use `FloatingPath.create(Path path, boolean forceClose)` to create FloatingPath.\nif the forceClose's value is true,the path will be forced to close .\n\nFor example：CurveFloatingPathEffect :\n\n```java\npublic class CurveFloatingPathEffect implements FloatingPathEffect {\n\n  @Override\n     public FloatingPath getFloatingPath(FloatingTextView floatingTextView) {\n         Path path = new Path();\n         path.moveTo(0, 0);\n         path.quadTo(-100, -200, 0, -300);\n         path.quadTo(200, -400, 0, -500);\n         return FloatingPath.create(path, false);\n     }\n}\n```\n\n####  4.Floating Path Animation\n\nAfter use  `FloatingPathEffect` to define the path,Then you should implements the  `BaseFloatingPathAnimator` interface and do path animation.\n\nFor example: `CurvePathFloatingAnimator` ：\n\n\n```java\npublic class CurvePathFloatingAnimator extends BaseFloatingPathAnimator {\n\n    @Override\n    public void applyFloatingPathAnimation(final FloatingTextView view, float start, float end) {\n\n        ValueAnimator translateAnimator = ObjectAnimator.ofFloat(start, end);\n        translateAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {\n            @Override\n            public void onAnimationUpdate(ValueAnimator valueAnimator) {\n                float value = (float) valueAnimator.getAnimatedValue();\n                float pos[] = getFloatingPosition(value);\n                float x = pos[0];\n                float y = pos[1];\n                view.setTranslationX(x);\n                view.setTranslationY(y);\n\n            }\n        });\n\n        translateAnimator.setDuration(3000);\n        translateAnimator.setStartDelay(50);\n        translateAnimator.start();\n\n    }\n}\n```\n\n-  `applyFloatingPathAnimation(final FloatingTextView view, float start, float end)` :\n\n  The param 'start' is the start value of the path,and the param 'end' is the end value of the path.\n\n- `getFloatingPosition(float progress)` :\n\n  get the current animated path value ,[0] is x，[1] is y.\n\n\n# Changelog\n\n\n### Version: 0.2.0\n\n* Fix the position bug - Thanks [MarsVard](https://github.com/MarsVard) contribution\n\n\n### Version: 0.1.0\n\n* Initial Build\n\n\n\nLicense ![License](https://img.shields.io/hexpm/l/plug.svg)\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","funding_links":[],"categories":["TextView"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FUFreedom%2FFloatingText","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FUFreedom%2FFloatingText","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FUFreedom%2FFloatingText/lists"}