tag | 034c59729a5bb9dd6a2ef19625d686eefe7bb8c0 | |
---|---|---|
tagger | The Android Open Source Project <initial-contribution@android.com> | Fri Jun 19 16:31:22 2020 -0700 |
object | 73d5ff6b06a961af9814a993966bc3f2de72f9f5 |
Platform Tools Release 30.0.3 (6597393)
commit | 73d5ff6b06a961af9814a993966bc3f2de72f9f5 | [log] [tgz] |
---|---|---|
author | android-build-prod (mdb) <android-build-team-robot@google.com> | Wed May 27 20:46:33 2020 +0000 |
committer | android-build-prod (mdb) <android-build-team-robot@google.com> | Wed May 27 20:46:33 2020 +0000 |
tree | 9592bf9684acdfea0834af4a5d7fe02fb78590b5 | |
parent | 5cd500efce90fd687bfe410c9b9e2ed329a2d671 [diff] | |
parent | 24b16880d9048a48aaece4975589bac2bf385899 [diff] |
Snap for 6533464 from 24b16880d9048a48aaece4975589bac2bf385899 to sdk-release Change-Id: I1527f302160ee485194d5216ac942e9a79fbffb0
The Universal Tween Engine enables the interpolation of every attribute from any object in any Java project (being Swing, SWT, OpenGL or even Console-based). Implement the TweenAccessor interface, register it to the engine, and animate anything you want!
In one line, send your objects to another position (here x=20 and y=30), with a smooth elastic transition, during 1 second).
// Arguments are (1) the target, (2) the type of interpolation, // and (3) the duration in seconds. Additional methods specify // the target values, and the easing function. Tween.to(mySprite, Type.POSITION_XY, 1.0f).target(20, 30).ease(Elastic.INOUT); // Possibilities are: Tween.to(...); // interpolates from the current values to the targets Tween.from(...); // interpolates from the given values to the current ones Tween.set(...); // apply the target values without animation (useful with a delay) Tween.call(...); // calls a method (useful with a delay) // Current options are: myTween.delay(0.5f); myTween.repeat(2, 0.5f); myTween.repeatYoyo(2, 0.5f); myTween.pause(); myTween.resume(); myTween.setCallback(callback); myTween.setCallbackTriggers(flags); myTween.setUserData(obj); // You can of course chain everything: Tween.to(...).delay(1.0f).repeat(2, 0.5f).start(myManager); // Moreover, slow-motion, fast-motion and reverse play is easy, // you just need to change the speed of the update: myManager.update(delta * speed);
Create some powerful animation sequences!
Timeline.createSequence() // First, set all objects to their initial positions .push(Tween.set(...)) .push(Tween.set(...)) .push(Tween.set(...)) // Wait 1s .pushPause(1.0f) // Move the objects around, one after the other .push(Tween.to(...)) .push(Tween.to(...)) .push(Tween.to(...)) // Then, move the objects around at the same time .beginParallel() .push(Tween.to(...)) .push(Tween.to(...)) .push(Tween.to(...)) .end() // And repeat the whole sequence 2 times // with a 0.5s pause between each iteration .repeatYoyo(2, 0.5f) // Let's go! .start(myManager);
You can also quickly create timers:
Tween.call(myCallback).delay(3000).start(myManager);
Main features are:
Detailed documentation with code snippets and examples is available for the following topics:
Get started --- A step-by-step example to get you started, with code
The TweenAccessor interface --- Know how to implement it
Tweens and options --- See what are the possibilities
Timelines and options --- Learn how to build powerful sequences
Animating Android apps --- See how to use the engine with Android UIs
There is a dedicated forum for you: http://www.aurelienribon.com/forum/viewforum.php?f=5
Also, the following link will guide you to a discussion thread that started it all:
http://www.badlogicgames.com/forum/viewtopic.php?f=17&t=494