https://github.com/florent37/Depth
Add some Depth to your fragments
https://github.com/florent37/Depth
3d android animation depth design fragment material scale transition translation
Last synced: 15 days ago
JSON representation
Add some Depth to your fragments
- Host: GitHub
- URL: https://github.com/florent37/Depth
- Owner: florent37
- License: mit
- Archived: true
- Created: 2017-03-02T15:27:00.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-10-01T09:07:09.000Z (over 6 years ago)
- Last Synced: 2024-11-09T18:42:53.353Z (6 months ago)
- Topics: 3d, android, animation, depth, design, fragment, material, scale, transition, translation
- Language: Java
- Homepage:
- Size: 10.8 MB
- Stars: 779
- Watchers: 27
- Forks: 93
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-github-android-ui - Depth - 在fragments中添加Depth (其他)
README
# Depth
Add some Depth to your fragments
[](https://github.com/florent37/Depth)
[](https://github.com/florent37/Depth)**The blue comes from the activity background color**
In your **activity**
```java
final Depth depth = DepthProvider.getDepth(container);
depth
.animate()
.reduce(oldFragment).exit(oldFragment)
.enter(newFragment)
.start();
```In your **fragment**
```java
private Depth depth;@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
this.depth = DepthProvider.getDepth(container);
return depth.setupFragment(10f, 10f, inflater.inflate(R.layout.fragment_1, container, false));
}@Override
public void onViewCreated(final View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);depth.onFragmentReady(this);
}
```# Customize the animations
```java
depth
.animate()
.reduce(oldFragment, new ReduceConfiguration()
.setRotationZ(0f)
.setRotationX(30f)
.setDuration(1000)
).exit(oldFragment, new ExitConfiguration()
.setFinalXPercent(0f)
.setFinalYPercent(-1f)
)
.enter(newFragment, new EnterConfiguration()
.setInitialXPercent(0f)
.setInitialYPercent(1f)
.setInitialRotationZ(0f)
.setInitialRotationX(30f)
)
.start();
```[](https://github.com/florent37/Depth)
[](https://github.com/florent37/Depth)# Add multiples DepthLayouts
Don't use `depth.setupFragment(`
But manually create your own layout with `DepthRelativeLayoutContainer`and `DepthRelativeLayout`
```xml
```
[](https://github.com/florent37/Depth)
#Download
In your module [](https://bintray.com/florent37/maven/depth/_latestVersion)
```groovy
compile 'com.github.florent37:depth:1.0.0'
```# Changelog
## 1.0.0
Initial import
# Community
Forked from [danielzeller/Depth-LIB-Android-](https://github.com/danielzeller/Depth-LIB-Android-)
Thanks for their amazing work !# Credits
Author: Florent Champigny
Fiches Plateau Moto : [https://www.fiches-plateau-moto.fr/](https://www.fiches-plateau-moto.fr/)
# License
Copyright 2017 florent37, Inc.
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 athttp://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.