KeyframeSequance to Animation

KeyframeSequanceAnimation module v2.12

2.1 changelog:

  • Reverse
  • Fixed Playing
  • Changed GetRig name to make more sense
    2.11 changelog:
  • I just figured out why you was unable to play more than 1 animation its now fixed
  • V.C0: can play animations using C0 of motor
    2.12:
  • Frame things

This took whole 17 days to update the module from 1.0 to 2.0 (i though that it took 30 days lol)

Supports Events,R15,R6,Loops,Easing Styles and much more!

Point of this module is to let you play animations though KeyframeSequance or Table in online mode!

In this post i want to showcase my module that letting you play keyframesequance animations.
feel free to edit it but i be very happy if you like or leave a credit to this module in your creations.Since its using KeyframeSequance and TweenService this may result into tons of bugs and lags and overall i dont recomend you using it in serious projects.
This my frist module that i made so it would be very unreadable ig.
But lets talk how to set it up!
Frist you can use id of module

i still suggest using C1 version instead of C0 its more natural to roblox engine

C1 Animations:

local AnimLibrary = require(15187566463)

C0 Animations

local AnimLibrary = require(15397576266)

^^ id is the same and not changed but here below i leave old version of module so you see all changes.
Archived

second you can get module and put into replicated storage or model you want to use

C1 Animations:

C1 Animations Version

C0 Animations:

C0 Animations Version

Lets talk about its advantages and disadvantages
Advantages

Can animate C0 if needed (roblox uses C1 for it but module can do this too)
Module is completally free and open source
have some features that roblox animations doesnt have
“Static” animations without consuming perfomance
You can play any non published animation
Supports R15 and R6
Simple to edit (i hope)

Disdvantages

Does not download copy of animation to a client and have to replicate it manually if played on a server,also its not optimized at all
Only support Motor6D animations

How does it work?
Module using own system based on tables and all information have to be converted into table
In most cases there enough to use only 1 command to do so but if its complex rig this may take a while

API

Generating Rig Table:

.GetBasicR15(rig) //Returns table with offsets and motors that exist in default R15 Dummy

.GetBasicRig6(rig) //Returns table with offsets and motors that exist in default R6 Dummy

.SetOwnRigStructure(tableData) //if you want make it by yourself and make own life harder use it its
so hard way that even creator of this post forgor how to use it

.OffSetTableReturn(model) //this probably old brother of “.GenerateRig(model)” but i edited it so many times that forgor

.GenerateRig(model) //Auto Generating Rig Table make sure that your rig currently not using any animations or else offsets may be broken

=============================================================================
Ok so once you got rig table your life will be easier and hardest part of module is done
Generating Keyframe Table:

.GenerateKeyframe(KeyFrameSequance) //Returns table of Keyframe sequance nothing hard really
Here Exemples of converting anims into table:
image
image
Your so damn right!I couldnt make quality of pictures even worse!xd

How module works?
Module reads all keyframes,sorts it and moves into format that readable
image

Animation API

Before go to animation list you need to make animation

local animation = AnimLibrary.new(RigTableHere,KeyframeSequanceTableHere)

now after it you can apply animation api to it
exemple:

animation:Play(0)

so here all api:

:SetSpeed(speed) -- Sets speed
:AddSpeed(speedAdd) -- adds speed
:SubstractSpeed(speedSubstract) -- subsctracts speed
:Stop() -- stops animation but doesn't resets motors position
:Cancel() -- like :Stop but now also resets position
:ResetMotors() -- reset motors6d position (probably wont work if animation is playing)
:SetFrame(numberOfFrame) -- basically static animation select index of frame you want to see for eternity đź’€
:GetAmoutOfFrames() -- return amout of frames in animation
:GetFrames() -- return frames in animation
:Play(OutSpeed) -- Plays animation OutSpeed means it automatically move rigs to default position if 0 it sets it automatically if nothing or nil it just freeze animation on last frame
==========================================
.Playing // returns true or false
.FrameIndex // if you set index 15 for exemple it will start animation from 15th frame or how you guys call it "Keyframe" 1 is default and automatically set
.AcceptFrameDrop //if true animation will use frame drop to sycronize its time better but it will lose quality false is default
.Animated //if false it disables tweens and will just teleport bodypart to next Keyframe true is default
.Speed //name says about everything 1 is default
.Reverse //Just reverses animation also dont worry about .FrameIndex here please its autofixes
.Looped //name says about everything false is default
.Frame // Current frame of animation
//Now most interesting part:
.EventListener // You can listen to events of animation and Markers all API will be below:
-------- Inside this lines API C0 VERSION OF MODULE ONLY!!!:
.JointsWhiteListC1 = {}
exemple:
.JointsWhiteListC1 = {"Neck"} // This will make ONLY rig named "Neck" playing as C1!! others will remain C0!
------

Events

There 2 types of event in module “AnimationStatus” and “Markers”
Markers comes from Roblox Animations as you know but AnimationStatus comes from module
connect animation Events is very easy:

animation.EventListener.Event:Connect(function(Type,ActionName,MarkerValue,MarkerTime)

end)

“Type” can return “AnimStatus” if its Module Event or “Event” if its AnimationMarker from Roblox
ActionName may return Module Event Name such as “Start” if animation Started or if its AnimationMarker will return name of “Event”
MarkerValue is a Value of Marker “Event” and MarkerTime is time when event supposed to heppen

Now lets talk about all possible Events that comes from this Module:

"Start" -- Animation Started !!This also may heppen if you using loop
"AnimEnd" -- Fires instantly once last keyframe of animation is searched but that doesnt not mean that animation is fully complited!!!
"End" -- Animation is ended.
"Loop" -- New loop has begun
"LoopClosed" -- if you disabled Loop while it was true and anim was playing this event will fire once anim is ended
"PosSet" -- fires once you used :SetFrame(numberOfFrame)
"KeyframePassed" //self explained
"ResetMotors" -- fires once you used :ResetMotors()
"Cancel" -- fires once you used :Cancel()
"Stop" -- fires once you used :Stop()

i hope i dont missed anything,Have a nice day and goodluck in using module!
i forgor to say in previous update that there exist

.GetHumanoidRigType(rig)
– idk why but i added it

I also made a plugin to convert it manually Keyframe into Text - Roblox

Also i will probably make it for Motor.C0 latter

10 Likes

Looking foward to using this.
This seems promising, i am too lazy to upload my animations.

2 Likes

I just found out that the way i getting motors6d are very weird and its probably the main reason why its broken.I will move it into :GetJoints() KeyFrameSequence, is it possible to make it play? - #4 by thatNOOBisSMART

1 Like

also i made that its adding cframe to already existing motor c1,but i need to get all offsets and adding to them.In updated version its now fixed (i hope)
but untill i dont make v2 of module its pointless to use.
most animations would work now

1 Like

image
default dance now works.The module works but i dont like way of how i made API
it needs to get new format

1 Like

im planning to add events and finish easing style aswell.
Its rn very raw module i update the post once its finished

hey uh
so i found a bug (or so i think)
i dont know if this is my rig or what, but the module only accepts the body parts, and nothing else

proof if needed:
robloxapp-20231105-1621498.wmv (271.0 KB)
(if you see the footage, the gun was supposed to move, but isnt.

1 Like

if you have specific rig you have to manually set motors (i dont implemented it yet but since you asking i will)
it took 10 mins to add lol

also did you used last version of module?
becouse frist version of module was kinda wierd and broken
module isnt finished to have all functions as needs but each day i updating it maybe in few weeks its be done

damn, ok.

cgharacter limit

i did, its maybe my rig then.

charlimit

guys i made major update wait like 20mins-2 hours its very huge changelog very hard to write

i just updated the module btw.Please tell if there any errors

i also made “Plugin” version of this module

also want to mention is that adding pause would be super easy
but i rn making plugin instead but knowing me i can just randomly decide to add it frist
this prob last update into module and it will be moved into plugin.Module got split into 2 parts so its bad idea to keep updating it
edit:
nvm guys i wont its too hard to make pause function
i added frame thing in case if you want to resume animation just set Frameindex to old Frame

okay so i found the cause
for some reason the module only accepts baseparts that are in the character model, not those that are in models in the character model.

i just figured out that code here is awfull and i need to move module into runservice and make tons of math operations to make it work better…Not anytime soon but i mb remake module.This was a test module and not serious anyways,next time it may be a bit better (i dont think so).I think the issue its so bugged is becouse of default yeilding system.Maybe there be easier way to fix it such as tween.Completed:Wait() i will check it latter