OUTDATED
PLEASE USE KeyframeSequance to Animation v4
New and better version of previous Module.
This module will work absolutelly differently to previous one!
This nodule is letting you play KeyframeAnimations in runtime dirrectly
Clear some confusions
- Previous one used C0/C1 but this one uses .Transform!
- Yes it still supports EasingStyle
- Yes its now supporting Skinned Mesh (Bone) animations aswell
- Yes aswell supports R6 and R15
Bonefits
- Instead of mindlessly going from frame to frame this one is trying to simulate a animation timeline and is dynamic to timeline aswell as more user friendly
- Have autofill for creating an animation class
- Have speed multiplier that can be not only positive but also a negative for reversing animation
- Have somewhat working animation blending
- Have a sync system that would sync animation if you set its play in middle of timeline for example
- have a public demo (yes real) it took me sometime to make
- all other bonefits from previous module
- Maybe better code?
- Split into smaller components for readability
- Plays both Motor6D and Bone (Skinned mesh) animations
Downsides
- bad optimization?
Either for my bad scripting or for it being Luau compare to roblox animator using C++ we have that we have
Demo showcase
Note: all animations (exept for sitting one :]) are not my and i got them randomly either from toolbox or Roblox Cartoon Animation pack
PublicDemo.rbxl (205.0 KB)
Module
- AnimationPlayer.rbxm (11.4 KB)
API
module.CreateModuleGroup(): ModuleScript
-- Module that can be passed into Group Parameter for Animation class
module.AutoGetMotor6D(Object:Model,Motor6DorBone:"Motor6D"|"Bone"): {}
-- Not important unless you want to manually pass it?
module.KeyFrameSequanceToTable(KeyFrameSequance:KeyframeSequence): {}
-- Not important it converts KeyFrameSequance into table that is used by module for animation.
module.new(Motor6DTable:Model|{},KeyFrameSequance:KeyframeSequence|{},Settings:SettingsType,AnimationGroup:ModuleScript?,Motor6DorBone:Motor6DorBones):AnimType
-- Animation Class itself
--[[
Parameters:
Motor6DTable -- Either Rig you making animation for or result of module.AutoGetMotor6D
KeyFrameSequance -- Either Keyframe sequance dirrectly or result of module.KeyFrameSequanceToTable
Settings: {} -- [[Custom Type where you can pass settings while creating animation
["Priority"]:Enum.AnimationPriority -- Is very important!!
]]
Optional Parameters [[
AnimationGroup -- result of module.CreateModuleGroup recomended if you want animations to not interupt each other put them in one group
]]
Motor6DorBone:"Motor6D"|"Bone"|nil
]]
Methods for animation
module:DestroyFadingData() -- used by another methods just ignore its existance
module:Cancel(DontResetMotor6D:boolean):YourAnimationHere.Settings.CurrentlyAt -- if DontResetMotor6D true does not reset motor6D to original position
method fully stops animation and deletes its thread
module:Freeze():YourAnimationHere.Settings.CurrentlyAt -- does not stop animation thread but prevents it from playing if that makes sense
module:UnFreeze() -- opposite of module:Freeze() (resumes thread)
module:Destroy() -- you already know what this method does...
module:Stop(FadeTime:number) --similar to module:Freeze() but it triggers fading time if passed in while :Play() or passed in :Stop() itself DOES NOT DELETES THREAD
module:Play(TimeStamp:number,FadeTime:number)
TimeStamp will trigger Settings["UpsyncThePlaying"] if possible
FadeTime will trigger if animation is not on loop
Plays animation itself
Events
self.Event:Connect(function(SygnalType: “MarkerSignal” | “KeyframeMarker”, Name: “string” ,Value: “string” | nil)
end)
- KeyframeMarker will fire only for KeyframeMarker instances in timeline (User defined animation events) and will return Name of it and Value
- MarkerSignal is an animation status related and NEVER RETURNS VALUE PARAMETER
Events for MarkerSignal
- Canceled fires after method :Cancel() being applied
- Frozen fires after method :Freeze() being applied
- UnFrozen fires after method :UnFreeze() being applied
- Stopped fires after method :Stop() being applied OR STOP OF ANIMATION WITHOUT FADING BEING ENDED YET
- Play fires after method :Play() being applied
- DidLoop fires after looped animation jumping into another loop
- Ended FULL STOP OF AN ANIMATION
Settings
Accesing settings = YourAnimationHere.Settings
[“Priority”]:Enum.AnimationPriority
[“Name”]:string – optional
[“StartsAt”]:number – force animation to start at X time of timeline
[“CurrentlyAt”]:number – you can force animation to change its time on timeline xd
[“Speed”]:number – speed multiplier of an animation,negative value reverses an animation
[“Playing”]:boolean – self explanatory
[“Loop”]:boolean – will animation loop?
[“Animate”]:boolean – supposed to remove all lerping completelly,was never tested more info you can find by reading comments in module itself
[“UpsyncThePlaying”]:number – here is a copy of comment in module:–[[
1 a little speed up ramp and then return to normal speed with now synced animation
2 increase speed in all animation to sync ]]
[“Lengh”]:number – lengh of an animation
Known issues
Module is not perfect but you can improve it
Animation blending is very poorly made and i will be super happy if anyone will fix it and will post on devforum