Style now attempts to replicate AnimationTrack style
This module is letting you to play KeyframeAnimations in runtime dirrectly
Clear some confusions
- Yes it still supports EasingStyle
- Yes its now supporting Skinned Mesh (Bone) animations aswell
- Yes aswell supports R6 and R15
- UNREPLICATABLE! You have to make own system to transport data and build class.
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
PublicDemo v2.3.rbxl (619.0 KB)
Note: all animations (exept for sitting one :]) are not my and i got them randomly either from toolbox or Roblox Cartoon Animation pack
Module
Module
- AnimationPlayer2.3.rbxm (12.6 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|{},AnimationGroup:ModuleScript?,Settings:SettingsType,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
Optional Parameters [[
AnimationGroup -- result of module.CreateModuleGroup recomended if you want animations to not interupt each other put them in one group
]]
Settings: {} -- [[Custom Type where you can pass settings while creating animation]]
Motor6DorBone:"Motor6D"|"Bone"|nil
]]
Methods for animation
module:StopFading() -- stops fading and removes all data in class assosiated with it
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:AdjustWeight:(weight: number,fadeTime: number)
module:Play(FadeTime:number,Weight:number,TimeStamp:number,Speed:number)
TimeStamp will trigger Settings["UpsyncThePlaying"] if possible
FadeTime will trigger if animation is not on loop
Plays animation itself
Events
Regular:
- Ended - FULL STOP OF AN ANIMATION
- Stopped - Animation Stopped but meight fade,use Ended if you want FULL STOP OF AN ANIMATION
-
DidLoop: true|false - animation with .Looped enabled commited a loop
If animation is reversed then false otherwise true
.Event
- 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
- Play fires after method :Play() being applied
Settings
-
self.Looped: boolean
-
self.TimePosition: number
-
self.IsPlaying: boolean
-
self.Speed: number
-
self.Weight: number
-
self.WeightCurrent: number
-
self.WeightTarget: number
-
self.Priority: Enum.AnimationPriority
-
self.Name: string
-
self.Animation: {}
-
self.Motor6D: {}
-
self.Settings: {
[“StartsAt”]:number;
[“CanTransformMotor6D”]:boolean|nil;–Don’t touch
[“Animate”]:“Animate”|“First”|“Last”|nil
[“UpsyncThePlaying”]:“Default”|“Ramp”|“SpeedUp”|nil;
} -
self.Length: number
-
self.Group: {}
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