您当前的位置: 首页 >  开发游戏的老王

AnimationPlayer类

开发游戏的老王 发布时间:2019-10-19 21:25:29 ,浏览量:5

Godot Engine 3.2 Alpha2

AnimationPlayer可以说是Godot的一大亮点,该类继承自Node这意味着Godot动画在2D/3D以及UI上都可以使用并且拥有同样的工作逻辑,AnimationPlayer可以置于节点树的不同层级,用于管理一个或多个物体上的动画,这个特性使它衍生出很多高级的玩法。AnimationPlayer还自带一个非常直观好用的可视化编辑器。

常用属性
类型属性名说明
Stringassigned_animation
Stringautoplay注意:是String而不是bool,当场景加载时默认播放的动画片段,默认为""
Stringcurrent_animation当前播放的动画名,如果没有的话,默认为""
floatcurrent_animation_length
floatcurrent_animation_position
boolplayback_active
floatplayback_default_blend_time
AnimationProcessModeplayback_process_mode枚举值ANIMATION_PROCESS_PHYSICS = 0常用于物理性物体;ANIMATION_PROCESS_IDLE = 1空闲过程;ANIMATION_PROCESS_MANUAL = 2手动
floatplayback_speed
NodePathroot_node遍历引用的起始位置,默认是".."即其父节点
常用方法
类型属性名说明
Erroradd_animation ( String name, Animation animation )
voidadvance ( float delta )
Stringanimation_get_next ( String anim_from ) const
voidanimation_set_next ( String anim_from, String anim_to )
voidclear_caches ( )
voidclear_queue ( )
Stringfind_animation ( Animation animation ) const
Animationget_animation ( String name ) const
PoolStringArrayget_animation_list ( ) const
floatget_blend_time ( String anim_from, String anim_to ) const
floatget_playing_speed ( ) const
PoolStringArrayget_queue ( )
boolhas_animation ( String name ) const查看是否有名为name的动画片段
boolis_playing ( ) const返回当前是否有动画播放
voidplay ( String name=”“, float custom_blend=-1, float custom_speed=1.0, bool from_end=false )播放动画,如果 custom_speed= -1.0, from_end= true,意味着回放
voidplay_backwards ( String name=”“, float custom_blend=-1 )
voidqueue ( String name )
voidremove_animation ( String name )
voidrename_animation ( String name, String newname )
voidseek ( float seconds, bool update=false )
voidset_blend_time ( String anim_from, String anim_to, float sec )
voidstop ( bool reset=true )停止当前动画
关注
打赏
查看更多评论

开发游戏的老王

暂无认证

  • 5浏览

    0关注

    326博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录