KeyFrameSequence Reader - Better LoadAnimation

KeyFrameModule V3 Here u can download it:

AnimatorModule_KeyFrameReader.rbxm (9.3 KB)

What is KeyFrameSequence?
KeyframeSequence - an object in Roblox that is used to store and manage animations. It is a set of keyframes that define the position, rotation, and scale of an object at specific points in time.

why is it better to use key frames?
In fact, Animation is a twin between keyframes (During the writing of the module, I realized that this is not the case, because it does not move desks - but Motor6D)

To begin with, roblox studio probably uses a fairly similar code to my module and the difference is minimal, however:

1 - If you have published an animation and deleted the KeyFrame, then you will have to re-publish this animation in order to update its ID. I don’t know about others, but it’s a big problem for me.

**2 -**The co-authors will also see this animation in the studio, which is very cool, because now you don’t have to publish the game just so that your friend can see the animation

3- Open source, you can completely change the type of animation playback with the exception of the already created 3 (transform, C0, Combined)

4 - (I’m bad at animation, tell me if I’m wrong) I also think it is important to mention the possibility of “FadeTime”, thanks to which animations can be made more dynamic

5 -
The point of the module is that you don’t have a question “why don’t I use a regular animator”. The module is designed not only for ordinary users who will find it easier to make a game using it, but also for people who will add other animationmodes for their games. (You can request their addition from me). Still, OpenSourse is better than CloseSourse. In general, there are moments where my module wins

API

  • Start
local AnimationClass = require( game.ReplicatedStorage.Animator ) -- Set your path
local AnimationObject = AnimationClass.new(game.Workspace:WaitForChild("Rig").Humanoid) -- Your rig (you can also use the player)
local AnimationTrack = AnimationObject:LoadAnimation(game.ReplicatedStorage.Animations.RigAnim) -- Path to KeyFrameSequence
  • AnimationModes

Animator.AnimationMode = ... ::number

AnimationObject.AnimationMode = 0 --[[Is "Transform mode - Modifies the entire CFrame of the joint(position and rotation) using joint.joint.Transform"]]
AnimationObject.AnimationMode = 1 --[[Is "C0 mode" - Modifies only the rotation of the joint using joint.joint.C0]]
AnimationObject.AnimationMode = 2 --[[Is new and best "Combined mode - Uses joint.joint.Transform for joints where the CFrame has changed,and joint.joint.C0 for all others."]]

  • Methods
Animation:Play(... , ... , ...) -- OPTIONAL you can specify FadeTime,Weight,Speed inside
Animation:Stop(... ::number) -- OPTIONAL you can specify FadeTime inside
Animation:AdjustSpeed(... ::number)
Animation:AdjustWeight(...::number) -- + OPTIONAL you can specify FadeTime

Animator:Destroy() --[[ TODO if your type not is a C0 mode then: ALWAYS call after Animation.Stopped:Wait() !!!]]

AnimationModule:GetPlayingAnimations() -- Idk, I didn't check if it worked. It seems to me that probably not
  • Attributes
print(Animation.Name::string)
print(Animation.Speed::number)
print(Animation.Length::number)
print(Animation.IsPlaying::BoolValue)
print(Animation.Looped::BoolValue) -- Can be changed (assigned to)
  • Signals
print("Wait","Connect","Once","Fire")
print(Animation.DidLoop)
print(Animation.Stopped)
print(Animation.Ended)
  • Priority
Animation.Priority = Enum.AnimationPriority:GetEnumItems()
9 Likes

I added every easing style! chars

This seems like an amazing module! I hope it gets more traction as it seems like quite a good module.

2 Likes

When I play an r15 animation it glitches out and spasms

Never mind fixed it by disabling Animate Localscript

image

Here is the fix

local TweenService = game:GetService("TweenService")

local round = math.round
local getValue = TweenService.GetValue
local easingDirections = Enum.EasingDirection:GetEnumItems()

local easingFuncs = {}

for _, poseEasingStyle in Enum.PoseEasingStyle:GetEnumItems() do
	if poseEasingStyle == Enum.PoseEasingStyle.Constant then
		continue
	end
	
	local directions = {}
	local easingStyle = Enum.EasingStyle:FromName(poseEasingStyle.Name)
	
	if easingStyle then
		for _, direction in easingDirections do

			directions[direction.Value] = function(a)
				return getValue(TweenService, a, easingStyle, direction)
			end
		end
		
		easingFuncs[poseEasingStyle.Value] = directions
	end
end

easingFuncs[Enum.PoseEasingStyle.Constant.Value] = {
	[0] = round,
	[1] = round,
	[2] = round,
}

local function getLerpAlpha(a, poseEasingStyleValue, poseEasingDirectionValue)
	return easingFuncs[poseEasingStyleValue][poseEasingDirectionValue](a)
end

return getLerpAlpha
1 Like

due to an innovation in which scripts have ceased to be !strict or !nonstrict by default my script has stopped giving out hints. And updating the script helped me get them back. I still haven’t figured out why, but the module also has Instance methods. If you find a solution, write

I fully rewrite the code and add a lot of typing. Here new version of module! It seems to be compatible with the previous version.

Here updated version (V3.1):
AnimatorModule_KeyFrameReader_V3.1.rbxm (6.9 KB)

1 Like

Look! I updated my model to “final version”. please, use it. It more optimized and have custom types.

Goodluck!