Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
org.skia.jetski.util.SkottieView Class Reference
Inheritance diagram for org.skia.jetski.util.SkottieView:

Public Member Functions

 SkottieView (Context context, int resID, Color background)
 
 SkottieView (Context context)
 
 SkottieView (Context context, AttributeSet attrs)
 
 SkottieView (Context context, AttributeSet attrs, int defStyleAttr)
 
 SkottieView (Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
 
void setSource (int resID, Context context, Color background)
 
void play ()
 
void pause ()
 
void seekTime (double t)
 
void seekFrame (double f)
 

Detailed Description

Definition at line 93 of file SkottieView.java.

Constructor & Destructor Documentation

◆ SkottieView() [1/5]

org.skia.jetski.util.SkottieView.SkottieView ( Context  context,
int  resID,
Color  background 
)
inline

Definition at line 99 of file SkottieView.java.

99 {
100 super(context);
101 mBackingView = new SurfaceView(context);
102 initBackingView();
103 InputStream inputStream = context.getResources().openRawResource(resID);
104 mRenderer = new SkottieRenderer(makeAnimation(inputStream), background);
105 mBackingView.getHolder().addCallback(mRenderer);
106 }

◆ SkottieView() [2/5]

org.skia.jetski.util.SkottieView.SkottieView ( Context  context)
inline

Definition at line 108 of file SkottieView.java.

108 {
109 super(context);
110 mBackingView = new SurfaceView(context);
111 initBackingView();
112 }

◆ SkottieView() [3/5]

org.skia.jetski.util.SkottieView.SkottieView ( Context  context,
AttributeSet  attrs 
)
inline

Definition at line 114 of file SkottieView.java.

114 {
115 this(context, attrs, 0, 0);
116 }

◆ SkottieView() [4/5]

org.skia.jetski.util.SkottieView.SkottieView ( Context  context,
AttributeSet  attrs,
int  defStyleAttr 
)
inline

Definition at line 118 of file SkottieView.java.

118 {
119 this(context, attrs, defStyleAttr, 0);
120 }

◆ SkottieView() [5/5]

org.skia.jetski.util.SkottieView.SkottieView ( Context  context,
AttributeSet  attrs,
int  defStyleAttr,
int  defStyleRes 
)
inline

Definition at line 123 of file SkottieView.java.

123 {
124 super(context, attrs);
125 TypedArray a = context.getTheme()
126 .obtainStyledAttributes(attrs, R.styleable.SkottieView, defStyleAttr, defStyleRes);
127 try {
128 // set backing view and background color
129 mBackingView = new SurfaceView(context);
130 initBackingView();
131 int backgroundColor = a.getColor(R.styleable.SkottieView_background_color, -1);
132 if (backgroundColor == -1) {
133 throw new RuntimeException("background_color attribute "
134 + "needed for SurfaceView");
135 }
136 if (android.graphics.Color.alpha(backgroundColor) != 255) {
137 throw new RuntimeException("background_color cannot be transparent");
138 }
139 // set source
140 int src = a.getResourceId(R.styleable.SkottieView_src, -1);
141 Color c = new Color(backgroundColor);
142 setSource(src, context, new Color(backgroundColor));
143 } finally {
144 a.recycle();
145 }
146 }
emscripten::val TypedArray
Definition WasmCommon.h:31
void setSource(int resID, Context context, Color background)
struct MyStruct a[10]
#define R(r)

Member Function Documentation

◆ pause()

void org.skia.jetski.util.SkottieView.pause ( )
inline

Definition at line 175 of file SkottieView.java.

175 {
176 mRenderer.pause();
177 }

◆ play()

void org.skia.jetski.util.SkottieView.play ( )
inline

Definition at line 171 of file SkottieView.java.

171 {
172 mRenderer.play();
173 }

◆ seekFrame()

void org.skia.jetski.util.SkottieView.seekFrame ( double  f)
inline

Definition at line 183 of file SkottieView.java.

183 {
184 double totalFrames = mRenderer.getAnimation().getFrameCount();
185 double totalTime = mRenderer.getAnimation().getDuration();
186 double targetTime = (f % totalFrames) / totalFrames * totalTime;
187 seekTime(targetTime);
188 }

◆ seekTime()

void org.skia.jetski.util.SkottieView.seekTime ( double  t)
inline

Definition at line 179 of file SkottieView.java.

179 {
180 mRenderer.setBaseTime(java.lang.System.currentTimeMillis() - ((long)t * 1000));
181 }

◆ setSource()

void org.skia.jetski.util.SkottieView.setSource ( int  resID,
Context  context,
Color  background 
)
inline

Definition at line 165 of file SkottieView.java.

165 {
166 InputStream inputStream = context.getResources().openRawResource(resID);
167 mRenderer = new SkottieRenderer(makeAnimation(inputStream), background);
168 mBackingView.getHolder().addCallback(mRenderer);
169 }

The documentation for this class was generated from the following file: