设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 128|回复: 0

[转载发布] Iavra Animate Everything

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9071

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58883
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68848

    灌水之王

    发表于 2026-8-1 08:22:59 | 显示全部楼层 |阅读模式
    Description

    Allows animation of every numeric attribute on any object.

    Videos

    I'm currently working on some scripts to use this.

    Prerequisites

    (optional) "Iavra Weak Reference" (http://forums.rpgmakerweb.com/index.php?/topic/40868-iavra-weak-reference/) - only if Weak References are used.

    How to Use

    Place this script below every class that you want to support animating.

    Call one of the following methods to start an animation:

    IAVRA::ANIMATE.start(<object>, <attributes>, <duration>, <easing>, <delay>, <chain>) <callback><object>.iavra_animate_start(<attributes>, <duration>, <easing>, <delay>, <chain>) <callback># Parameters:# <object>:     Object to animate# <attributes>: Attributes, as a hash like {<name> => <target value>}# <duration>:   Animation duration, in frames. Defaults to 1.# <easing>:     Easing function to use. Defaults to :linear.# <delay>:      Delay before starting the animation, in frames. Defaults to 0.# <chain>:      If true, the animation will be queued and wait for older ones to finished first. Defaults to false.# <callback>:   An optional block to be execute, after the animation finished. "self" refers to the object.# ExampleIAVRA::ANIMATE.start(<object>, {:attr => 100}, 120, :linear, 60, true) {p self}The example will wait 60 frames, before animating the attribute :attr of <object> from its current value to 100 over the duration of 120 frames using linear easing.If :attr is already animating, the animation will be queued and wait for older ones to finish, first.

    After the animation completes, the supplied block is called and prints the object to the console.

    Most parameters have defaults, so you usually won't need to specify everything.

    WARNING: Since the animation data is stored inside the object and procs can't be serialized, make sure to only define a callback if the object either isn't included in the savefile or if you are sure, that the game won't be saved while the animation is running.

    To interact with animating objects, the following methods can be used:

    # Stops the animation for the specified attributes on the target. If no attributes are specified, stops all animations.IAVRA::ANIMATE.stop(<object>, *attrs)<object>.iavra_animate_stop(*attrs)# Skips the current animation for the selected attribute and advances the queue.IAVRA::ANIMATE.skip(<object>, *attrs)<object>.iavra_animate_skip(*attrs)# Returns the frame of the current animation for the selected attribute. Returns nil if the attribute isn't animating and 0 if the animation is delayed.IAVRA::ANIMATE.step(<object>, attr)<object>.iavra_animate_step(attr)# Returns true, if the object has any active, non-delayed animations.IAVRA::ANIMATE.animating?(<object>)<object>.iavra_animate_animating?All easing functions except :linear are contained in their own library script, so they can be swapped out for your own functions. The position of the library doesn't matter.Configuration

    To enable animating for a class (and all of its subclasses), you have to register it first, like this:

    CLASSES = {        Game_Picture => [                lambda {|a|    instance_variable_get
    "@#{a}")},                 lambda {|a, v| instance_variable_set
    "@#{a}", v)}        ]}Make sure to be as specific as possible (for example, registering your own Windows instead of Window_Base), to avoid unintended side effects.You can alter the default values of some parameters like this:

    # Default chaining behaviour. If set to true, all animations will be queued unless you define "false" when starting the animation.DEFAULT_CHAINING = false# Default easing function to use, if none is specified when starting the animation.DEFAULT_EASING = :linearYou can decide to use weak references to animated objects instead of referencing them directly. This adds a dependency to "Iavra Weak Reference":
                    Code:       
    1. WEAK_REFERENCES = false
    复制代码

    Terms of UseFree to use for both commercial and non-commercial games. Please give credit.

    Credits

    Iavra

    FAQ

    None so far

    Changelog

    (For changes done prior to release, look into the script)

    - 1.00: Release version

    - 1.01: Added the "step" method, that was previously removed. It returns the current frame of the active animation for an attribute. Returns 0 for delayed animations and nil if the attribute isn't animating.

    - 1.02: Moved the update_animation method to occur before the normal update, since the old version sometimes resulted in strange behaviour.

    - 1.03: Added dependency to "Iavra Weak Reference". Objects are now updated from outside and don't need their own update method anymore. They still have their own animation data, though, since checking equality with WeakRefs can be a nightmare.

    - 1.04: Added a new configuration option to toggle between Weak and Strong references. "Iavra Weak Reference" is only needed if Weak References are used.

    Special Thanks

    - Robert Penner (http://robertpenner.com/easing/): For creating the easing functions.

    - Exhydra: For testing and reporting a lot of early bugs.

    Download

    Script: http://pastebin.com/1MgCVWPe

    Library: http://pastebin.com/vExVACp5


    本贴来自国际rpgmaker官方论坛作者:Iavra处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/iavra-animate-everything.40801/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-17 21:11 , Processed in 0.103346 second(s), 60 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表