class TransparencyAnimationToggleView extends BaseToggleView
{
	private editable var m_AnimationTime : Float;
	default m_AnimationTime = 0.02f;
	private editable var m_HoverTransparency : Float;
	default m_HoverTransparency = 0.2f;
	private editable var m_PressTransparency : Float;
	default m_PressTransparency = 0.4f;
	private editable var m_DefaultTransparency : Float;
	default m_DefaultTransparency = 0f;
	private editable var m_DisabledTransparency : Float;
	default m_DisabledTransparency = 0f;
	private var m_AnimationProxies : array< inkAnimProxy >;
	private const editable var m_Targets : array< inkWidgetRef >;

	protected override function ToggleStateChanged( oldState : inkEToggleState, newState : inkEToggleState )
	{
		var i, limit : Int32;
		var targetTransparency : Float;
		var transparencyInterpolator : inkAnimTransparency;
		var animDef : inkAnimDef;
		switch( newState )
		{
			case inkEToggleState.Hover:
			case inkEToggleState.ToggledHover:
				targetTransparency = m_HoverTransparency;
			break;
			case inkEToggleState.ToggledPress:
			case inkEToggleState.Press:
				targetTransparency = m_PressTransparency;
			break;
			case inkEToggleState.Disabled:
				targetTransparency = m_DisabledTransparency;
			break;
			default:
				targetTransparency = m_DefaultTransparency;
			break;
		}
		for( i = 0, limit = m_AnimationProxies.Size(); i < limit; i += 1 )
		{
			if( m_AnimationProxies[ i ] && m_AnimationProxies[ i ].IsPlaying() )
			{
				m_AnimationProxies[ i ].Stop();
			}
		}
		m_AnimationProxies.Clear();
		animDef = new inkAnimDef;
		transparencyInterpolator = new inkAnimTransparency;
		transparencyInterpolator.SetEndTransparency( targetTransparency );
		transparencyInterpolator.SetDuration( m_AnimationTime );
		transparencyInterpolator.SetDirection( inkanimInterpolationDirection.To );
		animDef.AddInterpolator( transparencyInterpolator );
		for( i = 0, limit = m_Targets.Size(); i < limit; i += 1 )
		{
			m_AnimationProxies.PushBack( inkWidgetRef.PlayAnimation( m_Targets[ i ], animDef ) );
		}
	}

}

