{"id":13645119,"url":"https://github.com/AdevintaSpain/Parallax-Layer-Layout","last_synced_at":"2025-04-21T13:31:50.517Z","repository":{"id":54286814,"uuid":"64290670","full_name":"AdevintaSpain/Parallax-Layer-Layout","owner":"AdevintaSpain","description":"Layered parallax effect to any Android views","archived":false,"fork":false,"pushed_at":"2021-02-26T12:03:22.000Z","size":2035,"stargazers_count":955,"open_issues_count":7,"forks_count":91,"subscribers_count":25,"default_branch":"master","last_synced_at":"2024-05-22T06:13:27.495Z","etag":null,"topics":["android-library","parallax"],"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/AdevintaSpain.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}},"created_at":"2016-07-27T08:22:45.000Z","updated_at":"2024-03-21T23:11:34.000Z","dependencies_parsed_at":"2022-08-13T11:00:53.159Z","dependency_job_id":null,"html_url":"https://github.com/AdevintaSpain/Parallax-Layer-Layout","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdevintaSpain%2FParallax-Layer-Layout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdevintaSpain%2FParallax-Layer-Layout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdevintaSpain%2FParallax-Layer-Layout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdevintaSpain%2FParallax-Layer-Layout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AdevintaSpain","download_url":"https://codeload.github.com/AdevintaSpain/Parallax-Layer-Layout/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223823339,"owners_count":17208946,"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-library","parallax"],"created_at":"2024-08-02T01:02:27.816Z","updated_at":"2024-11-09T18:30:19.635Z","avatar_url":"https://github.com/AdevintaSpain.png","language":"Java","funding_links":[],"categories":["滚动视差(Parallex)"],"sub_categories":[],"readme":"# Parallax Layer Layout\n\n\u003cimg src=\"art/ovni.gif\" align=\"left\" width=\"204px\" height=\"168px\"/\u003e\n\u003cimg align=\"left\" width=\"0\" height=\"168px\" hspace=\"10\"/\u003e\n\n[![Bintray](https://img.shields.io/bintray/v/schibstedspain/maven/parallax-layer-layout.svg?maxAge=2592000)](https://bintray.com/schibstedspain/maven/parallax-layer-layout/) [![Build Status](https://travis-ci.org/SchibstedSpain/Parallax-Layer-Layout.svg?branch=master)](https://travis-ci.org/SchibstedSpain/Parallax-Layer-Layout)\n\nLets you add layered parallax effect to your Android views or images based on things like device rotation.\n\nWe use it at [InfoJobs](https://play.google.com/store/apps/details?id=net.infojobs.mobile.android) for our error and empty states.\n\n\u003cbr/\u003e\n\u003cbr/\u003e\n\u003cp align=\"center\"\u003e\n\u003cb\u003e\u003ca href=\"#usage\"\u003eUsage\u003c/a\u003e\u003c/b\u003e\n|\n\u003cb\u003e\u003ca href=\"#download\"\u003eDownload\u003c/a\u003e\u003c/b\u003e\n|\n\u003cb\u003e\u003ca href=\"#how-it-works\"\u003eHow it works\u003c/a\u003e\u003c/b\u003e\n|\n\u003cb\u003e\u003ca href=\"#customize\"\u003eCustomize\u003c/a\u003e\u003c/b\u003e\n|\n\u003cb\u003e\u003ca href=\"#contribute\"\u003eContribute\u003c/a\u003e\u003c/b\u003e\n\u003c/p\u003e\n\n# Usage\n\nIn your layout wrap your layers inside a **ParallaxLayerLayout**:\n\n```xml\n\u003ccom.schibsted.spain.parallaxlayerlayout.ParallaxLayerLayout\n    android:id=\"@+id/parallax\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\u003e\n    \u003cView\n        android:id=\"@+id/layer_3\"\n        android:layout_width=\"180dp\"\n        android:layout_height=\"180dp\"\n        android:background=\"@color/colorPrimaryDark\" /\u003e\n    \u003cView\n        android:id=\"@+id/layer_2\"\n        android:layout_width=\"120dp\"\n        android:layout_height=\"120dp\"\n        android:background=\"@color/colorPrimary\" /\u003e\n    \u003cView\n        android:id=\"@+id/layer_1\"\n        android:layout_width=\"80dp\"\n        android:layout_height=\"80dp\"\n        android:background=\"@color/colorAccent\" /\u003e\n            \n    \u003c/com.schibsted.spain.parallaxlayerlayout.ParallaxLayerLayout\u003e\n```\n\nIn your code create a **TranslationUpdater** and link it with the *ParallaxLayerLayout*:\n\n```java\nsensorTranslationUpdater = new SensorTranslationUpdater(this);\nparallaxLayout.setTranslationUpdater(sensorTranslationUpdater);\n\n// onResume\nsensorTranslationUpdater.registerSensorManager();\n\n// onPause\nsensorTranslationUpdater.unregisterSensorManager();\n```\n**Note:** Just for the sensor updater you'll need to register and unregister it in your onResume/onPause.\n\n# Download\nGrab the latest version from jCenter:\n\n```groovy\ndependencies {\n  compile 'com.schibsted.spain:parallax-layer-layout:1.1.2'\n}\n```\n\n\n# How it works\nThe layout applies a maximum offset to each of its views, starting with a **base offset** and adding one **offset increment** for each layer. \n\nThe higher view in the Z index is the closest one from the user perspective so it will only move with the base offset. The further the view from the user, the more it will move.\n\nThe parallax effect is applied based on an horizontal and vertical translations, ranging from -1.0 to 1.0. This translation is provided by an external TranslationUpdater. The library includes some:\n\n- **SensorTranslationUpdater:** Updates the translation based on the orientation sensors (roll and pitch).\n- **AnimatedTranslationUpdater:** Applies the translation automatically as a continuous animation. \n\n# Customize\n## Parallax offset\n\nYou can change the default offset for the effect within your xml with the attributes **parallaxOffsetBase** and **parallaxOffsetIncrement**:\n\n```xml\n\u003ccom.schibsted.spain.parallaxlayerlayout.ParallaxLayerLayout\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    app:parallaxOffsetBase=\"10dp\"\n    app:parallaxOffsetIncrement=\"5dp\"\u003e\n```\n*The defaul values are 10dp for the base and 5dp for the increment*\n\n## Vertical and horizontal effect scale\n\nSometimes you might want to reduce or increase the effect for vertical or horizontal movement.\n\n```xml\n\u003ccom.schibsted.spain.parallaxlayerlayout.ParallaxLayerLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        app:parallaxScaleVertical=\"0.25\"\n        \u003e\n```\nIn this example the views will move vertically a 25% with respect to what they move horizontally.\n\n*Note: The parallax scale doesn't scale the views, but rather the parallax movement*\n\n## Custom Z index\n\nBy default the parallax effect is applied in the views Z index. This means that the last view in the layout will be the one closer to the user, and so it will move less; and the first view will be the furthest and will move more.\n\nIf you need a different parallax order you can change this behavior by overriding the views index with the attribute **layout_parallaxZIndex**:\n\n```xml\n\u003ccom.schibsted.spain.parallaxlayerlayout.ParallaxLayerLayout\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\u003e\n\n    \u003cView\n        android:id=\"@+id/layer_2\"\n        android:layout_width=\"180dp\"\n        android:layout_height=\"180dp\"\n        android:background=\"@color/colorPrimaryDark\"\n        app:layout_parallaxZIndex=\"1\" /\u003e\n\n    \u003cView\n        android:id=\"@+id/layer_3\"\n        android:layout_width=\"120dp\"\n        android:layout_height=\"120dp\"\n        android:background=\"@color/colorPrimary\"\n        app:layout_parallaxZIndex=\"2\" /\u003e\n\n    \u003cView\n        android:id=\"@+id/layer_1\"\n        android:layout_width=\"80dp\"\n        android:layout_height=\"80dp\"\n        android:background=\"@color/colorAccent\"\n        app:layout_parallaxZIndex=\"0\" /\u003e\n\n\u003c/com.schibsted.spain.parallaxlayerlayout.ParallaxLayerLayout\u003e\n```\n\n## Static layer\n\nYou can disable the parallax effect in any of the views to stop them from moving with the attribute **layout_parallaxEnabled**:\n\n```xml\n\u003cView\n    android:id=\"@+id/layer_static\"\n    android:layout_width=\"180dp\"\n    android:layout_height=\"180dp\"\n    android:background=\"@color/colorPrimaryDark\"\n    app:layout_parallaxEnabled=\"false\" /\u003e\n```\n\n\n# Contribute\nFor bugs, requests, questions and discussions please use [Github Issues](https://github.com/SchibstedSpain/parallax-layer-layout/issues).\t\n\n# Attributions\nThis library was developed by [Rafa Vázquez](https://github.com/Sloy/) with the idea of moving images from [Alex Bailón](https://github.com/abailon) for the [Infojobs' Android application](https://play.google.com/store/apps/details?id=net.infojobs.mobile.android).\n\n# Device requirements\nThis layout needs a gyroscope powered device. Sadly, there are some low-end phones that doesn't have it. In that case, the layered will appear like a static image.\n\n# License\n\n```\nCopyright 2016 Schibsted Classified Media Spain S.L.\n\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAdevintaSpain%2FParallax-Layer-Layout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAdevintaSpain%2FParallax-Layer-Layout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAdevintaSpain%2FParallax-Layer-Layout/lists"}