All Projects → imablanco → Parallax

imablanco / Parallax

Easy parallax View for Android simulating Apple TV App Icons

Programming Languages

kotlin
9241 projects

Labels

Projects that are alternatives of or similar to Parallax

newstagram
Simple iOS news feed app where you can customize categories and regions.
Stars: ✭ 16 (-94.1%)
Mutual labels:  parallax
Parallaxie
Easiest, Responsive and Customizable Parallax jQuery Plugin
Stars: ✭ 65 (-76.01%)
Mutual labels:  parallax
scrollxp
Alpine.js-esque library for scrolling animations on websites
Stars: ✭ 50 (-81.55%)
Mutual labels:  parallax
doodle-android
Colorful live wallpapers with auto dark mode and power-efficient animations
Stars: ✭ 440 (+62.36%)
Mutual labels:  parallax
parallax-effect
🤹🏻‍♂️ Parallax effect in javascript using face tracking. An immersive view in 3d with webcam.
Stars: ✭ 299 (+10.33%)
Mutual labels:  parallax
neodigm55
An eclectic low-code vanilla JavaScript UX micro-library for those that defiantly think for themselves.
Stars: ✭ 14 (-94.83%)
Mutual labels:  parallax
React Parallax Tilt
👀 Easily apply tilt hover effect on React components - lightweight/zero dependencies
Stars: ✭ 243 (-10.33%)
Mutual labels:  parallax
englishextra.github.io
English Grammar for Russian-Speakers, a PWA website + SPA
Stars: ✭ 19 (-92.99%)
Mutual labels:  parallax
whatisnewdialog
An Android library for displaying a dialog where it presents new features in the app.
Stars: ✭ 22 (-91.88%)
Mutual labels:  parallax
PAM
[TPAMI 2020] Parallax Attention for Unsupervised Stereo Correspondence Learning
Stars: ✭ 62 (-77.12%)
Mutual labels:  parallax
smooth-parallax
Smooth Parallax makes it a lot easier to move objects when the page scroll with ease.
Stars: ✭ 66 (-75.65%)
Mutual labels:  parallax
DrinksGalleryApp
Xamarin.Forms goodlooking UI sample using the new CarouselView (Parallax).
Stars: ✭ 51 (-81.18%)
Mutual labels:  parallax
momentum
Track movement and basic events with CSS custom properties
Stars: ✭ 19 (-92.99%)
Mutual labels:  parallax
hongkong
A parallax scroll effect plugin
Stars: ✭ 46 (-83.03%)
Mutual labels:  parallax
Perspective
🖼Parallax scrolling effect. And more.
Stars: ✭ 80 (-70.48%)
Mutual labels:  parallax
universal-parallax
Easy parallax plugin using pure javascript. Also works on mobile platforms. Cross browser support.
Stars: ✭ 107 (-60.52%)
Mutual labels:  parallax
svelte-parallax
a (small) spring-based parallax component library for Svelte
Stars: ✭ 87 (-67.9%)
Mutual labels:  parallax
Perspective
Powerful scrolling and motion parallax for iOS
Stars: ✭ 260 (-4.06%)
Mutual labels:  parallax
vue3-spring
A spring-physics based animation library, and more
Stars: ✭ 30 (-88.93%)
Mutual labels:  parallax
react-rellax
React Parallax component using Rellax.js
Stars: ✭ 39 (-85.61%)
Mutual labels:  parallax

Parallax

Easy parallax View for Android simulating Apple TV App Icons

alt tag

Installation

Parallax is available in the JCenter

compile 'com.ablanco.parallax:parallax:{latest version}'

where {latest version} corresponds to published version in JCenter Download

How does it work?

Parallax works by adding ParallaxView instances to a ParallaxContainer. Every ParallaxView should have LayerView instances as children. To make the parallax effect happens, ParallaxView uses LayerView (that are no other than FrameLayouts with extra functionality) instances and apply X/Y translations to them based on the index they have, where the smalles view index takes the greater parallax effect.

To start using Parallax, make your root view an instance of ParallaxContainer

    <?xml version="1.0" encoding="utf-8"?>
    <com.ablanco.parallax.ParallaxContainer xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    </com.ablanco.parallax.ParallaxContainer>
            

Inside it, add instances of ParallaxView, where you can add instances of LayerView

<com.ablanco.parallax.ParallaxView
        android:id="@+id/parallaxView"
        android:layout_width="300dp"
        android:layout_height="200dp">

        <com.ablanco.parallax.LayerView
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            
            ...
        </com.ablanco.parallax.LayerView>

        <com.ablanco.parallax.LayerView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:useParallaxPadding="false">
            
            ...
        </com.ablanco.parallax.LayerView>

        <com.ablanco.parallax.LayerView
            android:layout_width="match_parent"
            android:layout_height="match_parent">
           
            ...
        </com.ablanco.parallax.LayerView>


    </com.ablanco.parallax.ParallaxView>
            

As ParallaxView uses its LayerView index to apply parallax effect, the first LayerView added will be the farthest View from the user's perspective

Instances of LayerView can be added from code too

     val layerView = LayerView(this)
     layerView.addView(layerImage)
     parallaxView.addLayer(layerView)    

Customization

ParallaxView can be customized in varios ways:

  • You can alternate between two touch modes:

PRESSED

Pressed touch mode will apply ParallaxView interaction as if the user were pressing the View, applying depth perspective rotation along user finger movement

LIFTED

Quite the opposite to Pressed mode, ParallaxView will act as if it were sticky into user's finger, just like in Apple TV App Icons

    <com.ablanco.parallax.ParallaxView
        android:id="@+id/parallaxView"
        android:layout_width="300dp"
        android:layout_height="200dp"
        app:touchMode="lifted|pressed"/>         

Available from code too

        parallaxView.touchMode = ParallaxView.TOUCH_MODE_LIFTED | ParallaxView.TOUCH_MODE_PRESSED
  • You can change the parallax movement distance too, with is by default 5dp. The higher the value, the higher the parallax effect will be
    <com.ablanco.parallax.ParallaxView
        android:id="@+id/parallaxView"
        android:layout_width="300dp"
        android:layout_height="200dp"
        app:parallaxMovementDistance="10dp"/>       

And from code

        parallaxView.setParallaxMovementDistance(dstanceInPixels)
  • Last, but not least, you can change the behavior of the first layer from the user perspective. By default, last layer added will no apply any parallax effect, but you can change this behavior:
    <com.ablanco.parallax.ParallaxView
        android:id="@+id/parallaxView"
        android:layout_width="300dp"
        android:layout_height="200dp"
        app:firstLayerAppliesParallax="true|false by default"/>
        parallaxView.firstLayerAppliesParallax(true)

Hey we are not done yet!

LayerView can be customized too by defining if its content will be padded. Because ParallaxView applies translation movements to achieve parallax effect, LayerView instances applies negative margins by default to ensure the Layer border will never be visible. If any of your layers does not need this behaviour you can disable it (think as background images, which usually fills all the content, as Layers that need to have this behavior enabled):

 <com.ablanco.parallax.LayerView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:useParallaxPadding="false|true by default">
            ...
        </com.ablanco.parallax.LayerView>
        LayerView(this).useParallaxPadding = false

Now we are done!

Check out the sample app and do not forget to star this repo if you find it useful!

License

Copyright 2017 Álvaro Blanco Cabrero
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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].