private Overlay objMeshTest(int appWidth, int appHeight) { ObjLoader objLoader = new ObjLoader(); objLoader.loadObj(Res.openAssets("teaport.obj")); VertexBufferObject vertexData = new VertexBufferObject(objLoader.getVertexNum(), objLoader.getAttributes()); vertexData.setVertices(objLoader.getVertexData()); Mesh objMesh = new Mesh(vertexData); objMesh.setPos(0.85f * appWidth, appHeight / 2, 0); objMesh.addGlStatusController(new CullFaceController(BothSide)); Texture texture = new Texture(R.drawable.mask1); texture.setParams(Texture.Params.LINEAR_REPEAT); objMesh.setTexture(texture); TranslateAnimation translateAnimation = new TranslateAnimation(1000, -200, -50); ScaleAnimation scaleAnimation = new ScaleAnimation(1000, 2, 2); RotateAnimation rotateAnimation = new RotateAnimation(1000, 0, 180); rotateAnimation.setRotateVector(1, 1, 1); AnimationGroup group = new AnimationGroup(); group.add(translateAnimation); group.add(scaleAnimation); objMesh.startAnimation(group); return objMesh; }
private TestParticleSystem particleTest(int appWidth, int appHeight) { TestParticleSystem testParticleSystem = new TestParticleSystem(50, new Texture(R.drawable.spark)); testParticleSystem.addGlStatusController(new BlendController(GL_ONE, GL_ONE)); testParticleSystem.setPos(appWidth / 2, appHeight / 2, -100); RotateAnimation rotateAnimation = new RotateAnimation(10000, 0, 360); rotateAnimation.setRotateVector(1, 1, 1); rotateAnimation.setLoop(true); rotateAnimation.setInterpolator(new LinearInterpolator()); testParticleSystem.startAnimation(rotateAnimation); return testParticleSystem; }
private void buttonTest() { final ButtonOverlay btn = new ButtonOverlay(R.drawable.image2, R.drawable.mask2); // btn.setPos(0, btn.getHeight() + 50); RotateAnimation rotate = new RotateAnimation(2000, 0, 360); rotate.setRotateVector(1, 0, 0); rotate.setLoop(true); btn.startAnimation(rotate); btn.addGlStatusController(new CullFaceController(BothSide)); OverlayParent overlayParent = new OverlayParent(); overlayParent.addChild(btn); overlayParent.setPos(btn.getWidth() / 2, btn.getHeight()); addChild(overlayParent); }
private void init() { setVerticalFadingEdgeEnabled(false); headerContainer = (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.ptr_header, null); header = (RelativeLayout) headerContainer.findViewById(R.id.ptr_id_header); text = (TextView) header.findViewById(R.id.ptr_id_text); lastUpdatedTextView = (TextView) header.findViewById(R.id.ptr_id_last_updated); image = (ImageView) header.findViewById(R.id.ptr_id_image); spinner = (ProgressBar) header.findViewById(R.id.ptr_id_spinner); pullToRefreshText = getContext().getString(R.string.ptr_pull_to_refresh); releaseToRefreshText = getContext().getString(R.string.ptr_release_to_refresh); refreshingText = getContext().getString(R.string.ptr_refreshing); lastUpdatedText = getContext().getString(R.string.ptr_last_updated); flipAnimation = new RotateAnimation( 0, -180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); flipAnimation.setInterpolator(new LinearInterpolator()); flipAnimation.setDuration(ROTATE_ARROW_ANIMATION_DURATION); flipAnimation.setFillAfter(true); reverseFlipAnimation = new RotateAnimation( -180, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); reverseFlipAnimation.setInterpolator(new LinearInterpolator()); reverseFlipAnimation.setDuration(ROTATE_ARROW_ANIMATION_DURATION); reverseFlipAnimation.setFillAfter(true); addHeaderView(headerContainer); setState(State.PULL_TO_REFRESH); scrollbarEnabled = isVerticalScrollBarEnabled(); ViewTreeObserver vto = header.getViewTreeObserver(); vto.addOnGlobalLayoutListener(new PTROnGlobalLayoutListener()); super.setOnItemClickListener(new PTROnItemClickListener()); super.setOnItemLongClickListener(new PTROnItemLongClickListener()); }