then continue painting until it is fully completed matrix transformations , to enlarge the animation effect .
but the program has been a crash , so my idea of code impress , seeking Great God Guidelines
public void onDrawFrame(GL10 gl){
GLES20.glClear(GLES20.GL_DEPTH_BUFFER_BIT|GLES20.COLOR_BUFFER_BIT)
Thread Trans_Thread = new Thread(){
//zMove用来判定z轴位移量
float zMove = 0f;
public void run(){
boolean flag = true;
while(flag){
画四个图标
for(int i=0;i<4;i++){
//所有矩阵的定义和操作都放在了MatrixState.java里,纯方法实现
//矩阵平移,以便图标一字铺开。
MatrixState.translate(i*2f,0,0)
//被聚焦的图标会有动画放大的效果
if(FocusPosition == i){
//进行矩阵缩放,即图标缩放
MatrixState.scale(1.3f/50,1.3f/50,1.3f/50);
}
//Square类的绘制函数
Square.drawSelf();
}
//判定是否已经缩放完成
zMove = zMove + 1.3f/50;
//运行标志设为false
if(zMove>=1.3f) flag = false;
try(Thread.sleep(20);)catch(Exception e){System.out.println(e);}
}
}
}
Trans_Thread.start();
}
In the absence of additional threads can be stable drawing , but did not focus on the enlarged icon animation .
Great God seek advice
------ Solution --------------------------------- -----------
I think the thread should be placed outside onDrawFrame, then postInvalidate () to inform the system update
------ eference -------- -------------------------------
thanks, buddy, this problem has been solved. Because onDrawFrame function itself is constantly refreshed, as long as the appropriate control parameters can be in it . Your reply this point be rewarded .
没有评论:
发表评论