xref: /aosp_15_r20/external/skia/tools/skottie_ios_app/SkottieViewController.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1*c8dee2aaSAndroid Build Coastguard Worker // Copyright 2019 Google LLC.
2*c8dee2aaSAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3*c8dee2aaSAndroid Build Coastguard Worker #ifndef SkottieViewController_DEFINED
4*c8dee2aaSAndroid Build Coastguard Worker #define SkottieViewController_DEFINED
5*c8dee2aaSAndroid Build Coastguard Worker 
6*c8dee2aaSAndroid Build Coastguard Worker #include "tools/skottie_ios_app/SkiaViewController.h"
7*c8dee2aaSAndroid Build Coastguard Worker 
8*c8dee2aaSAndroid Build Coastguard Worker #import <UIKit/UIKit.h>
9*c8dee2aaSAndroid Build Coastguard Worker 
10*c8dee2aaSAndroid Build Coastguard Worker // An abstraction of the Skottie module into Obective-C.
11*c8dee2aaSAndroid Build Coastguard Worker @interface SkottieViewController : SkiaViewController
12*c8dee2aaSAndroid Build Coastguard Worker - (void)draw:(CGRect)rect toCanvas:(SkCanvas*)canvas atSize:(CGSize)size;
13*c8dee2aaSAndroid Build Coastguard Worker 
14*c8dee2aaSAndroid Build Coastguard Worker // Return the current paused state.
15*c8dee2aaSAndroid Build Coastguard Worker - (bool)isPaused;
16*c8dee2aaSAndroid Build Coastguard Worker 
17*c8dee2aaSAndroid Build Coastguard Worker // When set, pauses at end of loop.
18*c8dee2aaSAndroid Build Coastguard Worker - (void)setStopAtEnd:(bool)stop;
19*c8dee2aaSAndroid Build Coastguard Worker 
20*c8dee2aaSAndroid Build Coastguard Worker // Load an animation from a Lottie JSON file.  Returns Yes on success.
21*c8dee2aaSAndroid Build Coastguard Worker - (bool)loadAnimation:(NSData*)d;
22*c8dee2aaSAndroid Build Coastguard Worker 
23*c8dee2aaSAndroid Build Coastguard Worker // Jump to the specified location in the animation.
24*c8dee2aaSAndroid Build Coastguard Worker - (void)seek:(float)seconds;
25*c8dee2aaSAndroid Build Coastguard Worker 
26*c8dee2aaSAndroid Build Coastguard Worker // Toggle paused mode.  Return paused state.
27*c8dee2aaSAndroid Build Coastguard Worker - (bool)togglePaused;
28*c8dee2aaSAndroid Build Coastguard Worker 
29*c8dee2aaSAndroid Build Coastguard Worker // Return the default size of the Lottie animation.
30*c8dee2aaSAndroid Build Coastguard Worker - (CGSize)size;
31*c8dee2aaSAndroid Build Coastguard Worker 
32*c8dee2aaSAndroid Build Coastguard Worker // Return the length of the animation loop.
33*c8dee2aaSAndroid Build Coastguard Worker - (float)animationDurationSeconds;
34*c8dee2aaSAndroid Build Coastguard Worker 
35*c8dee2aaSAndroid Build Coastguard Worker // Return the current position in the animation in seconds (between zero and
36*c8dee2aaSAndroid Build Coastguard Worker // animationDurationSeconds).
37*c8dee2aaSAndroid Build Coastguard Worker - (float)currentTime;
38*c8dee2aaSAndroid Build Coastguard Worker @end
39*c8dee2aaSAndroid Build Coastguard Worker 
40*c8dee2aaSAndroid Build Coastguard Worker #endif  // SkottieViewController_DEFINED
41