Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
org.skia.jetskidemo.VSphereAnimator Class Reference

Public Member Functions

 VSphereAnimator (float x, float y, float r)
 
void animate (float dt)
 
Matrix getMatrix ()
 
void fling (float dx, float dy)
 
void startDrag (MotionEvent e)
 
void drag (MotionEvent e)
 

Detailed Description

Definition at line 82 of file CubeActivity.java.

Constructor & Destructor Documentation

◆ VSphereAnimator()

org.skia.jetskidemo.VSphereAnimator.VSphereAnimator ( float  x,
float  y,
float  r 
)
inline

Definition at line 91 of file CubeActivity.java.

91 {
92 mCenterX = x;
93 mCenterY = y;
94 mRadius = r;
95 }
double y
double x

Member Function Documentation

◆ animate()

void org.skia.jetskidemo.VSphereAnimator.animate ( float  dt)
inline

Definition at line 97 of file CubeActivity.java.

97 {
98 final float kDecay = 0.99f;
99
100 rotate(mRotAxis, mRotSpeed * dt);
101
102 mRotSpeed *= kDecay;
103 }

◆ drag()

void org.skia.jetskidemo.VSphereAnimator.drag ( MotionEvent  e)
inline

Definition at line 123 of file CubeActivity.java.

123 {
124 Vec3 u = mCurrentDrag, // previous drag position
125 v = normalVec(e.getX(), e.getY()); // new drag position
126
127 float angle = (float)Math.acos(Math.max(-1, Math.min(1, u.dot(v)/u.length()/v.length())));
128 Vec3 axis = u.cross(v).normalize();
129
130 rotate(axis, angle);
131
132 mCurrentDrag = v;
133 }

◆ fling()

void org.skia.jetskidemo.VSphereAnimator.fling ( float  dx,
float  dy 
)
inline

Definition at line 109 of file CubeActivity.java.

109 {
110 Vec3 u = normalVec(mCenterX, mCenterY),
111 v = normalVec(mCenterX + dx, mCenterY + dy);
112 mRotAxis = u.cross(v).normalize();
113
114 double flingSpeed = Math.sqrt(dx*dx + dy*dy)/mRadius;
115 mRotSpeed = (float)(flingSpeed*Math.PI);
116 }
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
Definition: SkRecords.h:208

◆ getMatrix()

Matrix org.skia.jetskidemo.VSphereAnimator.getMatrix ( )
inline

Definition at line 105 of file CubeActivity.java.

105 {
106 return mRotMatrix;
107 }

◆ startDrag()

void org.skia.jetskidemo.VSphereAnimator.startDrag ( MotionEvent  e)
inline

Definition at line 118 of file CubeActivity.java.

118 {
119 mCurrentDrag = normalVec(e.getX(), e.getY());
120 mRotSpeed = 0;
121 }

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