GithubHelp home page GithubHelp logo

yalantis / starwars.android Goto Github PK

View Code? Open in Web Editor NEW
1.9K 87.0 304.0 17.87 MB

This component implements transition animation to crumble view into tiny pieces.

Home Page: https://yalantis.com/blog/star-wars-the-force-awakens-or-how-to-crumble-view-into-tiny-pieces-on-android/

License: MIT License

Java 96.68% GLSL 3.32%
animation android opengl opengl-es glsl java transition

starwars.android's Introduction

StarWars.Android

License Maven Yalantis

This component implements transition animation to crumble view into tiny pieces.


Check this project on dribbble.

Also, read how it was done in our blog

##Requirements

  • Android SDK 15+
  • OpenGL ES 2.0+

##Usage

Add to your module's build.gradle:

dependencies {
    //...
    compile 'com.yalantis:starwarstiles:0.1.1'
}

Wrap your fragment or activity main view in TilesFrameLayout:

<com.yalantis.starwars.TilesFrameLayout
  android:id="@+id/tiles_frame_layout"
  android:layout_height="match_parent"
  android:layout_width="match_parent"
  app:sw_animationDuration="1500"
  app:sw_numberOfTilesX="35">

  <!-- Your views go here -->
     
</com.yalantis.starwars.TilesFrameLayout>

Adjust animation with these parameters:

  • app:sw_animationDuration – duration in milliseconds
  • app:sw_numberOfTilesX – the number of square tiles the plane is tessellated into broadwise
mTilesFrameLayout = (TilesFrameLayout) findViewById(R.id.tiles_frame);
mTilesFrameLayout.setOnAnimationFinishedListener(this);

In your activity or fragment’s onPause() and onResume() it’s important to call the corresponding methods:

@Override
public void onResume() {
    super.onResume();
    mTilesFrameLayout.onResume();
}

@Override
public void onPause() {
    super.onPause();
    mTilesFrameLayout.onPause();
}

To start the animation simply call:

mTilesFrameLayout.startAnimation();

Your callback will be called when the animation ends:

@Override
public void onAnimationFinished() {
   // Hide or remove your view/fragment/activity here
}

Have fun! :)

Let us know!

We’d be really happy if you sent us links to your projects where you use our component. Just send an email to [email protected] And do let us know if you have any questions or suggestion regarding the animation.

P.S. We’re going to publish more awesomeness wrapped in code and a tutorial on how to make UI for iOS (Android) better than better. Stay tuned!

License

The MIT License (MIT)

Copyright © 2017 Yalantis, https://yalantis.com

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

starwars.android's People

Contributors

mlatu avatar pgmacdesign avatar warko-san avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

starwars.android's Issues

Fatal Exception: Error loading texture

I got error report from this library.
how can I fix or check code?
is this bug?
I thik this error is not appear all time.
some device occur error

Fatal Exception: java.lang.RuntimeException: Error loading texture.
at com.yalantis.starwars.utils.gl.TextureHelper.loadTexture(TextureHelper.java:53)
at com.yalantis.starwars.render.StarWarsRenderer$2.run(StarWarsRenderer.java:290)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1471)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1248)

loadTexture crash by floating window

java.lang.RuntimeException: 0 0x0
at gl.TextureHelper.loadTexture(TextureHelper.java:42)
at render.StarWarsRenderer$2.run(StarWarsRenderer.java:289)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1535)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1293)

use floating Window ,then add custom view,include TileFrameLayout, crash

app crash

12-22 18:49:23.012 16155-16345/... E/AndroidRuntime: FATAL EXCEPTION: GLThread 3428
Process: ..., PID: 16155
java.lang.IndexOutOfBoundsException: offset=15120, count=3, length=15120
at java.nio.Buffer.checkPutBounds(Buffer.java:179)
at java.nio.DirectByteBuffer.put(DirectByteBuffer.java:378)
at java.nio.ByteBufferAsFloatBuffer.put(ByteBufferAsFloatBuffer.java:159)
at com.yalantis.starwars.render.Buffers.makeInterleavedBuffer(Buffers.java:30)
at com.yalantis.starwars.render.GenerateVerticesData$1.run(GenerateVerticesData.java:45)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1463)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

Это случилось, когда я подложил TilesFrameLayout под основной экран программы, view там достаточно тяжелая - ViewPager внутри фрагмента, listView и SurfaceView. Есть ли варианты избежать падения?
It happened when I planted Tiles FrameLayout under the main program screen, view there is heavy - ViewPager inside track, listView and SurfaceView. Are there options to avoid the drop?

GlSurfaceView draw backgroundImage

Hey guys, not a bug, my Question. I want to draw a background image in GLSurfaceView, but I don't know how to draw it. By setting GLSurfaceView‘s setZOrderOnTop will block my other layout, you can help me?

Redrawing the view

Hey guys, not a bug, but a Question, After the view gets obliterated via the call to startAnimation(), how do I go about redrawing it or making the view visible again? My goal is to have the ImageView disappear (shatter) using the animation, and then have it come back into view with a new image.
Thanks for the help and the awesome project guys! It's really well done!

Unknown element <library> found

The <library> tag in the AndroidManifest.xml causes compile error on Android Studio 3.0 with Gradle 3.0.0-beta6. Please remove that line.

GLThread 8862(8862) SIGSEGV(SEGV_MAPERR)

#00 pc 000000000001aeb0 /system/lib64/libc.so (memcpy+168) [arm64-v8a]

#1 pc 000000000016f724 /system/vendor/lib64/egl/libGLESv2_adreno.so (EsxVertexArrayObject::UpdateInternalVbos(EsxDrawDescriptor const*, unsigned int, EsxAttributeDesc const*)+1636) [arm64-v8a]
#2 pc 00000000002de428 /system/vendor/lib64/egl/libGLESv2_adreno.so (A5xVertexArrayObject::CalcVfdRegs(EsxDrawDescriptor const*, A5xVfdRegs*, int)+124) [arm64-v8a]
#3 pc 00000000002eaaa8 /system/vendor/lib64/egl/libGLESv2_adreno.so (A5xContext::ValidateState(EsxDrawDescriptor const*)+1984) [arm64-v8a]
#4 pc 00000000002ea2cc /system/vendor/lib64/egl/libGLESv2_adreno.so (A5xContext::HwValidateGfxState(EsxDrawDescriptor const*)+16) [arm64-v8a]
#5 pc 00000000000e42e4 /system/vendor/lib64/egl/libGLESv2_adreno.so (EsxContext::ValidateGfxState(EsxDrawDescriptor const*)+2924) [arm64-v8a]
#6 pc 00000000000cc41c /system/vendor/lib64/egl/libGLESv2_adreno.so (EsxContext::DrawArraysInstanced(EsxPrimType, int, unsigned int, unsigned int)+448) [arm64-v8a]
#7 pc 00000000021df8f4 /system/framework/arm64/boot-framework.oat (oatexec+8788212) [arm64-v8a]
9 java:
10 com.pop.music.particlesys.ParticleSystem.void render()(ParticleSystem.java:99)
11 com.pop.music.particlesys.ParticleSystemRenderer.void onDrawFrame$62c01aa1()(ParticleSystemRenderer.java:147)

Crashed, help help help !!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.