나는 앱으로 출시하고 싶은 작은 게임을 만들었습니다. 내 메뉴에 관한 성능 문제를 발견 할 때까지 모두 잘 돌아갔다. 내 메뉴의 애니메이션을 확대 및 이동하는 데 tweenlite의 libary를 사용합니다.AS3/Flash/AIR/TweenLite/큰 성능 문제 Tweenlite 스케일 애니메이션을 사용하는 AIR
내가 처음으로 내 갤럭시 S2에서 시도했을 때 약간의 느린 (framedrops)하지만 큰 거래는 오래된 전화이기 때문에. 그러나 지금은 원 플러스 하나 (현재 가장 빠른 전화)을 가지고 있고 그것은 여전히 프레임을 삭제하고 thougth blitmask 버퍼 노력에 대한
지금 내가 가진 CPU의 지옥을 많이 소모 :이 약 아니므로 (https://greensock.com/blitmask)을하지만, 큰 그림은 그 부분 만 보여 주지만 무비 클립을 확장하면 이것이 도움이 될지 궁금해하고있었습니다. SWF 출력의 데모 : http://websitekeuken.nl/demo/bloktris-app.swf
가장 늦은 시작 애니메이션이거나 "uitleg"탭을 누른 다음 항목을 완전히 드래그하여 해당 애니메이션을 복제하십시오.
누구나 프레임을 떨어 뜨리지 않거나 적어도 매끄럽게 만들 생각이 있습니까? 나는 전화가 현재 문제없이 전체 3D 게임을 실행할 수 있다는 것을 의미한다. 간단한 메뉴 애니메이션은 아무런 문제가 없다.
내가 이미 시도한 것들 : - FPS 낮추기; - 렌더링을 Direct 및 GPU로 설정합니다. - 모든 것을 비밀스런 비트 맵으로 숨기고 있지만 여전히 성공적이지는 않습니다. - 플래시 CC 데모의 최신 컴파일러
정말이 사람이 나를 도와 줄 수 있기를 바랍니다. 나는이 문제에 대해 10 시간 동안 노력하고 있습니다. 미리 감사드립니다.
나는 누군가가이 문제에 대해 10 시간을 일해야한다는 것을 알고 나를 도와 줄 수 있기를 바랍니다. 미리 감사드립니다.
기본 메뉴 클래스 : 모든
package com.eigen.menu
{
/**
* ...
* @author matthijs
*/
// http://www.polymer-project.org/apps/topeka/
import com.greensock.BlitMask;
import com.greensock.easing.Bounce;
import com.greensock.easing.BounceIn;
import com.greensock.easing.Elastic;
import com.greensock.TimelineLite;
import fl.transitions.easing.Regular;
import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
import flash.display.MovieClip;
import flash.display.Shape;
import flash.display.Stage;
import flash.errors.IllegalOperationError;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.utils.getTimer;
import com.greensock.TweenLite;
import com.greensock.easing.Strong;
import com.greensock.plugins.TweenPlugin;
import flash.geom.Rectangle;
// todo save inbouwen
// http://stackoverflow.com/questions/24074092/flash-as3-save-and-load-data-for-ios-and-android-games
public class DragMenu extends MovieClip
{
private var bounds : Rectangle;
private var mc : MovieClip;
var startX:Number, startY:Number;
var border:MovieClip;
var menuObjects:MenuObjects;
var lockSwipe:Boolean = false;
var isTransitioningOut = false;
public function DragMenu()
{
startX = this.x;
startY = this.y;
}
public function reboot()
{
TweenLite.killTweensOf(this);
isTransitioningOut = false;
visible = true;
alpha = 1;
this.addEventListener(Event.ENTER_FRAME, handleCollision)
this.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
}
public function init(menuObjects:MenuObjects)
{
this.visible = false;
this.border = menuObjects.border;
this.menuObjects = menuObjects;
}
public function show(type:String = ""):void
{
debug("show");
reboot();
if (type == "slide")
animateInSlide();
else
animateInElastic();
}
function animateInElastic()
{
debug("animateInElastic");
x = startX
y = startY;
scaleX=0;
scaleY=0;
//var bm:BlitMask = new BlitMask(this, 300, 300, this.width, this.height, true);
//TweenLite.to(content, 30, {x:-3000, onUpdate:bm.update});
//TweenLite.to(this, 4, { scaleX:1, scaleY:1, ease:Elastic.easeOut, onUpdate:bm.update });
TweenLite.to(this, 4, { scaleX:1, scaleY:1, ease:Elastic.easeOut });
}
function animateOutElastic()
{
debug("animateOutElastic");
var myTimeline:TimelineLite = new TimelineLite();
var duration:Number = 1;
myTimeline.add(TweenLite.to(this, duration, { x:startX, y:1024 + 1024/2, alpha:0 }),
0,
"start",
0);
myTimeline.add(transitioningOutDone, duration);
}
function animateInSlide()
{
debug("animateInSlide");
scaleX = 1;
scaleY = 1;
y = -1024 + 1024/2;
TweenLite.to(this, 2, { y:1024/2, ease:Bounce.easeOut });
}
function animateOutSlide()
{
debug("animateOutSlide");
isTransitioningOut = true;
var myTimeline:TimelineLite = new TimelineLite();
var duration:Number = 2;
myTimeline.add([new TweenLite(this, 0.3, { scaleX:1, scaleY:1, ease:Regular.easeOut }),
new TweenLite(this, duration, { y:1024 + 1024/2, ease:Bounce.easeOut })],
0,
"start",
0);
myTimeline.add(transitioningOutDone, duration);
}
protected function transitioningOutDone()
{
if (isTransitioningOut == false)
return;
x = startX;
y = startY;
visible = false;
isTransitioningOut = false;
}
private function mouseDownHandler(event:MouseEvent):void {
if (lockSwipe)
return;
this.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
TweenLite.killTweensOf(this);
scaleX=1;
scaleY = 1;
alpha = 1;
var rec:Rectangle = new Rectangle(this.width/2,this.height/2-200,0,2000);
this.startDrag(false, rec);
}
private function mouseUpHandler(event:MouseEvent):void {
this.stopDrag();
TweenLite.killTweensOf(this);
scaleX=1;
scaleY = 1;
TweenLite.to(this, 4, { x:startX, y:startY, ease:Elastic.easeOut });
}
function handleCollision(e:Event):void
{
if (lockSwipe || isTransitioningOut)
return;
if(border != null && this.hitTestObject(border))
{
trace (this.name + "handleCollision");
trace("x = " + x);
trace("y = " + y);
trace("scaleX = " + scaleX);
this.stopDrag();
this.removeEventListener(Event.ENTER_FRAME, handleCollision)
this.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
this.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
TweenLite.killTweensOf(this);
animateOutElastic();
switchTo();
}
}
public function switchTo():void
{
throw new IllegalOperationError("Must override Concreate Class");
}
protected function debug(message:String)
{
trace(this.name + " " + message);
}
}
}
GPU에서 고도로 최적화되고 렌더링되기 때문에 모바일 게임이 가능합니다. 모바일 장치의 약한 CPU에 문제가있는 한 가지는 벡터 그래픽이 많이 필요하기 때문에 벡터 그래픽이 표시되고 모바일에서 쉽게 fps가 떨어집니다. – BotMaster
cacheAsBitmap에 메뉴를 설정해 보셨습니까? 'this.cacheAsBitmap (true)' –
Parcell 예.하지만 100 % 확실하지는 않다고 생각합니다. 이제 – matthy