MCAnim - Gears 制作的 Minecraft 动画库
MCAnim 是一个 Minecraft 数据包库,旨在让在您的 Minecraft 世界中运行某些动画变得轻松。它目前仅支持显示实体插值,但我计划后续扩展以包含粒子实用函数。
当前功能:
-
播放动画
有四种方式可以播放动画:generic(通用)、scale(缩放)、translate(平移)和 rotate(旋转)。Generic 允许您同时应用多种动画,包括修改持续时间。首先运行命令 data modify storage mcanim:api/display_animation/generic animation set value {},并将 {} 替换为您的数据来调用此功能。这支持设置 duration 属性,该属性决定动画的长度,其他任何属性将被视为一种动画。Scale 和 translate 执行相同的操作,但接受 x、y 和 z 属性。Rotate 则先将 x、y 和 z 值转换为四元数。然后以您想要动画的实体身份运行函数 mcanim:api/display_animation/<function>,即可看到其播放效果。
-
旋转与四元数
Rotation 也接受以度为单位的 x、y、z 分量,但由于 Minecraft 使用四元数进行旋转,它会自动将给定的角度转换为四元数。可以通过手动将 mcanim:api/maths/xyz_to_quaternion target 设置为 {x, y, z} 或 [x, y, z] 来完成此操作,其中每个属性都给出所需的值。然后运行 function mcanim:api/maths/xyz_to_quaternion。结果将存储在 mcanim:api/maths/xyz_to_quaternion output 中。
相反的功能也存在,即将四元数转换为其 x、y 和 z 分量。
注意:此功能目前无法正常工作。输出值将不准确,因此建议不要使用此功能。
类似于上述操作,将 mcanim:api/maths/quaternion_to_xyz target 设置为 [x, y, z, w] 或 {x, y, z, w}(w 被忽略,因此是可选的)。然后运行 function mcanim:api/maths/quaternion_to_xyz。如预期所示,生成的数组:[x, y, z] 可在 mcanim:api/maths/quaternion_to_xyz output 中找到。
以上是目前已实现的所有功能,如果您想提出更多建议或报告错误,请在 GitHub 页面上创建问题。
MCAnim - A Minecraft animation library by Gears
MCAnim is a Minecraft datapack library that aims to make it easy to run certain animations in your Minecraft world. It currently only supports display entity interpolation, but I plan on expanding it to include particle utility functions later.
Current features:
-
Animation playing
There are four ways to play animations: generic, scale, translate and rotate. Generic allows you to apply many animations including modifying duration at the same time. Called by running first the command data modify storage mcanim:api/display_animation/generic animation set value {}, and replacing the {} with your data. This supports setting the duration property, which decides the length of the animation, and any other property will be treated as an animation. Scale and translate do the same, but take x, y and z properties instead. Rotate converts the x, y and z values into a quaternion first. Then run the function mcanim:api/display_animation/<function> as the entity you want to animate, to see it play.
-
Rotation and quaternions
Rotation also takes x, y and z components in degrees, but as Minecraft uses quaternions for rotation, it automatically converts the angles given into quaternions. This can be done manually by setting the mcanim:api/maths/xyz_to_quaternion target to {x, y, z} or [x, y, z], where you give each property the desired value. Then run function mcanim:api/maths/xyz_to_quaternion. The result will be in mcanim:api/maths/xyz_to_quaternion output
The same feature exists the other way around, converting a quaternion to its x, y and z components.
NOTE: This feature is currently not working properly. The output values will be inaccurate, so it is suggested not to use this.
Similar to the above, set mcanim:api/maths/quaternion_to_xyz target to [x, y, z, w] or {x, y, z, w} (w is ignored, so optional). Then run function mcanim:api/maths/quaternion_to_xyz. As expected, the resulting array: [x, y, z] is found in mcanim:api/maths/quaternion_to_xyz output
Those are all of the features currently implemented, if you would like to suggest more or report a bug, please create an issue on the github page.
评论 0
登录后参与评分
还没有评论,来抢沙发吧