Definition at line 25 of file SkottieAnimation.java.
◆ SkottieAnimation() [1/3]
org.skia.skottie.SkottieAnimation.SkottieAnimation |
( |
SurfaceTexture |
surfaceTexture, |
|
|
InputStream |
is |
|
) |
| |
|
inlinepackage |
Definition at line 50 of file SkottieAnimation.java.
50 {
51 if (init(is)) {
52 mSurfaceTexture = surfaceTexture;
53 }
54 }
◆ SkottieAnimation() [2/3]
org.skia.skottie.SkottieAnimation.SkottieAnimation |
( |
TextureView |
view, |
|
|
InputStream |
is, |
|
|
int |
backgroundColor, |
|
|
int |
repeatCount |
|
) |
| |
|
inlinepackage |
Definition at line 55 of file SkottieAnimation.java.
55 {
56 if (init(is)) {
57 mSurfaceTexture = view.getSurfaceTexture();
58 }
59 view.setSurfaceTextureListener(this);
60 mBackgroundColor = backgroundColor;
61 mRepeatCount = repeatCount;
62 mRepeatCounter = mRepeatCount;
63 }
◆ SkottieAnimation() [3/3]
org.skia.skottie.SkottieAnimation.SkottieAnimation |
( |
SurfaceView |
view, |
|
|
InputStream |
is, |
|
|
int |
backgroundColor, |
|
|
int |
repeatCount |
|
) |
| |
|
inlinepackage |
Definition at line 65 of file SkottieAnimation.java.
65 {
66 if (init(is)) {
67 mSurfaceHolder = view.getHolder();
68 }
69 mSurfaceHolder.addCallback(this);
70 mBackgroundColor = backgroundColor;
71 mRepeatCount = repeatCount;
72 mRepeatCounter = mRepeatCount;
73 }
◆ doFrame()
void org.skia.skottie.SkottieAnimation.doFrame |
( |
long |
frameTimeNanos | ) |
|
|
inline |
Definition at line 378 of file SkottieAnimation.java.
378 {
379 if (mIsRunning) {
380
381 Choreographer.getInstance().postFrameCallback(this);
382
383
384 long durationNS = mDuration * 1000000;
385 long timeSinceAnimationStartNS = frameTimeNanos - mAnimationStartTime;
386 long animationProgressNS = timeSinceAnimationStartNS % durationNS;
387 mProgress = animationProgressNS / (
float)durationNS;
388 if (timeSinceAnimationStartNS > durationNS) {
389 mAnimationStartTime += durationNS;
390 }
391 if (timeSinceAnimationStartNS > durationNS) {
392 if (mRepeatCounter > 0) {
393 mRepeatCounter--;
394 } else if (mRepeatCounter == 0) {
395 mIsRunning = false;
396 mProgress = 1;
397 notifyAnimationEnd();
398 }
399 }
400 }
402 drawFrame();
403 }
404 }
◆ end()
void org.skia.skottie.SkottieAnimation.end |
( |
| ) |
|
|
inline |
Definition at line 176 of file SkottieAnimation.java.
176 {
177 try {
179 mIsRunning = false;
180 if (mEglSurface != null) {
181
185 mEglSurface = null;
186 }
187 });
188 }
189 catch (Throwable t) {
190 Log.e(LOG_TAG,
"stop failed", t);
191 throw new RuntimeException(t);
192 }
193 notifyAnimationEnd();
194 }
void runOnGLThread(Runnable r)
EGLSurface mPBufferSurface
void Log(const char *format,...) SK_PRINTF_LIKE(1
◆ finalize()
void org.skia.skottie.SkottieAnimation.finalize |
( |
| ) |
throws Throwable |
|
inlineprotected |
Definition at line 132 of file SkottieAnimation.java.
132 {
133 try {
135 nDeleteProxy(mNativeProxy);
136 mNativeProxy = 0;
137 } finally {
138 super.finalize();
139 }
140 }
◆ getBackingViewConfig()
Config org.skia.skottie.SkottieAnimation.getBackingViewConfig |
( |
| ) |
|
|
inlinepackage |
◆ getDuration()
long org.skia.skottie.SkottieAnimation.getDuration |
( |
| ) |
|
|
inline |
◆ getProgress()
float org.skia.skottie.SkottieAnimation.getProgress |
( |
| ) |
|
|
inline |
◆ getStartDelay()
long org.skia.skottie.SkottieAnimation.getStartDelay |
( |
| ) |
|
|
inline |
◆ getTotalDuration()
long org.skia.skottie.SkottieAnimation.getTotalDuration |
( |
| ) |
|
|
inline |
Definition at line 256 of file SkottieAnimation.java.
256 {
257 if (mRepeatCount == -1) {
258 return DURATION_INFINITE;
259 }
260
261 return mDuration * (1 + mRepeatCount);
262 }
◆ isRunning()
boolean org.skia.skottie.SkottieAnimation.isRunning |
( |
| ) |
|
|
inline |
◆ onSurfaceTextureAvailable()
void org.skia.skottie.SkottieAnimation.onSurfaceTextureAvailable |
( |
SurfaceTexture |
surface, |
|
|
int |
width, |
|
|
int |
height |
|
) |
| |
|
inline |
Definition at line 407 of file SkottieAnimation.java.
407 {
408
409 try {
413 config.mValidSurface = true;
414 });
415 }
416 catch (Throwable t) {
417 Log.e(LOG_TAG,
"updateSurface failed", t);
418 throw new RuntimeException(t);
419 }
420 }
void updateSurface(int width, int height)
◆ onSurfaceTextureDestroyed()
boolean org.skia.skottie.SkottieAnimation.onSurfaceTextureDestroyed |
( |
SurfaceTexture |
surface | ) |
|
|
inline |
Definition at line 429 of file SkottieAnimation.java.
429 {
430
432 config.mValidSurface = false;
433 return true;
434 }
void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height)
◆ onSurfaceTextureSizeChanged()
void org.skia.skottie.SkottieAnimation.onSurfaceTextureSizeChanged |
( |
SurfaceTexture |
surface, |
|
|
int |
width, |
|
|
int |
height |
|
) |
| |
|
inline |
◆ onSurfaceTextureUpdated()
void org.skia.skottie.SkottieAnimation.onSurfaceTextureUpdated |
( |
SurfaceTexture |
surfaceTexture | ) |
|
|
inline |
◆ pause()
void org.skia.skottie.SkottieAnimation.pause |
( |
| ) |
|
|
inline |
Definition at line 197 of file SkottieAnimation.java.
197 {
198 try {
200 mIsRunning = false;
201 });
202 }
203 catch (Throwable t) {
204 Log.e(LOG_TAG,
"pause failed", t);
205 throw new RuntimeException(t);
206 }
207 }
◆ resume()
void org.skia.skottie.SkottieAnimation.resume |
( |
| ) |
|
|
inline |
Definition at line 210 of file SkottieAnimation.java.
210 {
211 try {
213 if (!mIsRunning) {
214 long currentTime = System.nanoTime();
215 mAnimationStartTime = currentTime - (long)(1000000 * mDuration * mProgress);
216 mIsRunning = true;
217 mNewSurface = true;
219 }
220 });
221 }
222 catch (Throwable t) {
223 Log.e(LOG_TAG,
"resume failed", t);
224 throw new RuntimeException(t);
225 }
226 }
void doFrame(long frameTimeNanos)
◆ setBackingViewConfig()
void org.skia.skottie.SkottieAnimation.setBackingViewConfig |
( |
Config |
config | ) |
|
|
inlinepackage |
◆ setDuration()
Animator org.skia.skottie.SkottieAnimation.setDuration |
( |
long |
duration | ) |
|
|
inline |
◆ setInterpolator()
void org.skia.skottie.SkottieAnimation.setInterpolator |
( |
TimeInterpolator |
value | ) |
|
|
inline |
◆ setProgress()
void org.skia.skottie.SkottieAnimation.setProgress |
( |
float |
progress | ) |
|
|
inline |
Definition at line 270 of file SkottieAnimation.java.
270 {
271 try {
273 mProgress = progress;
274 if (mIsRunning) {
275 mAnimationStartTime = System.nanoTime()
276 - (long)(1000000 * mDuration * mProgress);
277 }
278 drawFrame();
279 });
280 }
281 catch (Throwable t) {
282 Log.e(LOG_TAG,
"setProgress failed", t);
283 throw new RuntimeException(t);
284 }
285 }
◆ setStartDelay()
void org.skia.skottie.SkottieAnimation.setStartDelay |
( |
long |
startDelay | ) |
|
|
inline |
◆ setSurfaceTexture()
void org.skia.skottie.SkottieAnimation.setSurfaceTexture |
( |
SurfaceTexture |
s | ) |
|
|
inlinepackage |
◆ start()
void org.skia.skottie.SkottieAnimation.start |
( |
| ) |
|
|
inline |
Definition at line 151 of file SkottieAnimation.java.
151 {
152 try {
154 if (!mIsRunning) {
155 long currentTime = System.nanoTime();
156 mAnimationStartTime = currentTime - (long)(1000000 * mDuration * mProgress);
157 mIsRunning = true;
158 mNewSurface = true;
159 mRepeatCounter = mRepeatCount;
161 }
162 });
163 }
164 catch (Throwable t) {
165 Log.e(LOG_TAG,
"start failed", t);
166 throw new RuntimeException(t);
167 }
168 if (this.getListeners() != null) {
169 for (AnimatorListener l : this.getListeners()) {
170 l.onAnimationStart(this);
171 }
172 }
173 }
◆ surfaceChanged()
void org.skia.skottie.SkottieAnimation.surfaceChanged |
( |
SurfaceHolder |
holder, |
|
|
int |
format, |
|
|
int |
width, |
|
|
int |
height |
|
) |
| |
|
inline |
Definition at line 447 of file SkottieAnimation.java.
447 {
448 try {
450 mSurfaceHolder = holder;
452 config.mValidSurface = true;
453 });
454 }
455 catch (Throwable t) {
456 Log.e(LOG_TAG,
"updateSurface failed", t);
457 throw new RuntimeException(t);
458 }
459 }
◆ surfaceCreated()
void org.skia.skottie.SkottieAnimation.surfaceCreated |
( |
SurfaceHolder |
holder | ) |
|
|
inline |
◆ surfaceDestroyed()
void org.skia.skottie.SkottieAnimation.surfaceDestroyed |
( |
SurfaceHolder |
holder | ) |
|
|
inline |
Definition at line 462 of file SkottieAnimation.java.
462 {
463 config.mValidSurface = false;
465 }
void surfaceChanged(SurfaceHolder holder, int format, int width, int height)
◆ updateSurface()
void org.skia.skottie.SkottieAnimation.updateSurface |
( |
int |
width, |
|
|
int |
height |
|
) |
| |
|
inline |
Definition at line 143 of file SkottieAnimation.java.
143 {
144 config.mSurfaceWidth =
width;
145 config.mSurfaceHeight =
height;
146 mNewSurface = true;
147 drawFrame();
148 }
The documentation for this class was generated from the following file:
- third_party/skia/platform_tools/android/apps/skottie/skottielib/src/main/java/org/skia/skottie/SkottieAnimation.java