CAnimationVariableIntegerChangeHandler 类

实现回调,它在动画变量值更改时由动画 API 调用。

语法

class CAnimationVariableIntegerChangeHandler : public CUIAnimationVariableIntegerChangeHandlerBase<CAnimationVariableIntegerChangeHandler>;

成员

公共构造函数

名称 描述
CAnimationVariableIntegerChangeHandler::CAnimationVariableIntegerChangeHandler 构造 CAnimationVariableIntegerChangeHandler 对象。

公共方法

名称 描述
CAnimationVariableIntegerChangeHandler::CreateInstance 创建 CAnimationVariableIntegerChangeHandler 回叫的实例。
CAnimationVariableIntegerChangeHandler::OnIntegerValueChanged 当动画变量的值发生更改时调用。 (替代 CUIAnimationVariableIntegerChangeHandlerBase::OnIntegerValueChanged。)
CAnimationVariableIntegerChangeHandler::SetAnimationController 存储指向动画控制器以路由事件的指针。

备注

调用 CAnimationVariable::EnableIntegerValueChangedEvent 或 CAnimationBaseObject::EnableIntegerValueChangedEvent 时(这将为所有封装在动画对象中的动画变量启用此事件),将创建此事件处理程序并将其传递给 IUIAnimationVariable::SetVariableIntegerChangeHandler 方法。

继承层次结构

MFC 类

CUIAnimationCallbackBase

CUIAnimationVariableIntegerChangeHandlerBase

CAnimationVariableIntegerChangeHandler

要求

标头: afxanimationcontroller.h

CAnimationVariableIntegerChangeHandler::CAnimationVariableIntegerChangeHandler

构造 CAnimationVariableIntegerChangeHandler 对象。

CAnimationVariableIntegerChangeHandler ();

CAnimationVariableIntegerChangeHandler::CreateInstance

创建 CAnimationVariableIntegerChangeHandler 回叫的实例。

static COM_DECLSPEC_NOTHROW HRESULT CreateInstance(
    CAnimationController* pAnimationController,
    IUIAnimationVariableIntegerChangeHandler** ppHandler);

参数

pAnimationController
指向动画控制器的指针,该控制器将接收事件。

ppHandler

返回值

如果该方法成功,则它会返回 S_OK。 否则,它将返回 HRESULT 错误代码。

CAnimationVariableIntegerChangeHandler::OnIntegerValueChanged

当动画变量的值发生更改时调用。

IFACEMETHOD(OnIntegerValueChanged) (
    __in IUIAnimationStoryboard* storyboard,
    __in IUIAnimationVariable* variable,
    __in INT32 newValue,
    __in INT32 previousValue);

参数

storyboard
正在对变量进行动画处理的情节提要。

variable
已更新的动画变量。

newValue
新的舍入后的值。

previousValue
上一个舍入后的值。

返回值

如果方法成功,则为 S_OK;否则为 E_FAIL。

CAnimationVariableIntegerChangeHandler::SetAnimationController

存储指向动画控制器以路由事件的指针。

void SetAnimationController(CAnimationController* pAnimationController);

参数

pAnimationController
指向动画控制器的指针,该控制器将接收事件。

另请参阅