它看起來像喬什Tynjala正在添加此功能羽毛:https://github.com/joshtynjala/feathers/issues/527
在此期間,我想同樣的事情,所以我就颳起這件事,我很高興與大家分享它(警告:尚未得到廣泛的測試):
package com.hiddenachievement.space.components
{
import feathers.core.FeathersControl;
import starling.animation.Transitions;
import starling.animation.Tween;
import starling.core.Starling;
import starling.display.Sprite;
/**
* Creates a control that emerges from one side of the stage, while moving the main view to show it.
*/
public class EdgeSlideControl extends FeathersControl
{
private var _mainView:Sprite;
private var _open:Boolean;
protected var _tween:Tween;
protected var _side:int;
protected var _callback:Function;
protected var _uncover:Boolean;
static public const NORTH:int = 0;
static public const SOUTH:int = 1;
static public const EAST:int = 2;
static public const WEST:int = 3;
/**
* Creates an EdgeSlideControl.
*
* @param mainView The main view (possibly a ScreenNavigator) that will move to show the menu.
* @param side The side that the control will emerge from.
* @param uncover When true, the main view will slide away to uncover the control. When false, the control will slide in from the side, as the main view slides out of the way.
*
*/
public function EdgeSlideControl(mainView:Sprite, side:int, uncover:Boolean = true)
{
super();
_mainView = mainView;
_side = side;
_uncover = uncover;
}
/**
* Implements the standard FeathersControl's initialize.
*/
override protected function initialize():void
{
_open = false;
visible = false;
}
/**
* Begin the animation to display the control.
*/
public function show(callback:Function=null):void
{
_callback = callback;
_tween = new Tween(_mainView, 0.2, Transitions.LINEAR);
_tween.onUpdate = updateSlide;
_tween.onComplete = slideComplete;
switch(_side)
{
case NORTH:
_tween.animate("y", height);
break;
case SOUTH:
_tween.animate("y", -width);
break;
case EAST:
_tween.animate("x", -height);
break;
case WEST:
_tween.animate("x", width);
break;
}
Starling.juggler.add(_tween);
_open = true;
visible = true;
}
/**
* Begin the animation to hide the control.
*/
public function hide(callback:Function=null):void
{
_callback = callback;
_tween = new Tween(_mainView, 0.2, Transitions.LINEAR);
_tween.onUpdate = updateSlide;
_tween.onComplete = slideComplete;
switch(_side)
{
case NORTH:
case SOUTH:
_tween.animate("y", 0);
break;
case EAST:
case WEST:
_tween.animate("x", 0);
break;
}
Starling.juggler.add(_tween);
_open = false;
}
/**
* If the control is moving (not in "uncover" mode), move the control into place, next to the main view.
*/
public function updateSlide():void
{
if (!_uncover)
{
switch(_side)
{
case NORTH:
y = _mainView.y - height;
break;
case SOUTH:
y = _mainView.height - _mainView.y;
break;
case EAST:
x = _mainView.width - _mainView.x;
break;
case WEST:
x = _mainView.x - width;
break;
}
}
}
/**
* Perform any actions needed after the transition is done animating.
*/
public function slideComplete():void
{
if (_callback != null)
{
_callback();
}
visible = _open;
}
public function get isOpen():Boolean
{
return _open;
}
}
}
您可能需要一個明確的尺寸增加了分量,在滑動的方向,如果它的未來爲零。否則,使用應該非常簡單。讓我知道你是否需要關於如何使用它的更多指導。
謝謝,屏幕導航是偉大的,我以前使用過它,但我想屏幕滑動關閉,仍然會出現輕微的左/右。所以基本上我希望標籤和麪板滑動打開,然後用戶單擊相同的標籤關閉面板。也許我會整合瘋狂的組件面板。 – puks1978