-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinear-keyframe.js
63 lines (57 loc) · 2.02 KB
/
linear-keyframe.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
(function() {
const path = require('path');
const fs = require('fs');
const registeredButtons = [];
function handleConvertKeyframes() {
Project.animations.forEach(animation => {
if (animation.animators) {
for (const animatorKey in animation.animators) {
const animator = animation.animators[animatorKey];
if (animator.position) {
animator.position.forEach(keyframe => {
keyframe.interpolation = "linear"
})
}
if (animator.rotation) {
animator.rotation.forEach(keyframe => {
keyframe.interpolation = "linear"
})
}
if (animator.scale) {
animator.scale.forEach(keyframe => {
keyframe.interpolation = "linear"
})
}
}
}
})
}
function registerButton(button) {
registeredButtons.push(button);
return button;
}
function deleteAllButtons() {
registeredButtons.forEach(button => button.delete());
}
Plugin.register('linear-keyframe', {
title: 'Linear Keyframe',
author: 'Miquiis',
description: 'This plugins converts all keyframes on the animations back to linear.',
icon: 'movie',
version: '0.0.1',
variant: 'both',
onload() {
export_bulk = registerButton(new Action('convert_to_linear', {
name: 'Convert Keyframes to Linear',
description: 'Convert all keyframe to linear.',
icon: 'fas.fa-right-left',
condition(){return Project},
click: handleConvertKeyframes
}));
MenuBar.addAction(export_bulk, 'animation.4');
},
onunload() {
deleteAllButtons();
}
});
})();