Skip to content

Instantly share code, notes, and snippets.

View phileo's full-sized avatar

Phileo phileo

View GitHub Profile
@phileo
phileo / gist:bc7af6d7ff0ee2e3f61529b239b7ec32
Created December 12, 2019 02:20
DepthPageTransformer
class DepthPageTransformer: ViewPager.PageTransformer {
companion object {
private const val MIN_SCALE = 0.75f
}
override fun transformPage(view: View, position: Float) {
when {
position < -1 -> // [-Infinity,-1)
// This page is way off-screen to the left.
view.alpha = 0f
class ZoomPageTransformer: ViewPager.PageTransformer {
companion object {
private const val MIN_SCALE = 0.85f
private const val MIN_ALPHA = 0.5f
}
override fun transformPage(view: View, position: Float) {
val pageWidth = view.width
val pageHeight = view.height
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/media02_001" android:duration="25"/>
<item android:drawable="@drawable/media02_002" android:duration="25"/>
<item android:drawable="@drawable/media02_003" android:duration="25"/>
<item android:drawable="@drawable/media02_004" android:duration="25"/>
<item android:drawable="@drawable/media02_005" android:duration="25"/>
<item android:drawable="@drawable/media02_006" android:duration="25"/>
<item android:drawable="@drawable/media02_007" android:duration="25"/>