Keyfast
Script
Free

Select Position Keyframes

By Jack Vaughan
Updated 11/1/2025

About

Selects only position keyframes on selected layers. If keyframes are already selected, filters to show only position keyframes. If no keyframes are selected, selects all position keyframes on the selected layers.

Code

// Cavalry Script: Keyfast - Select position keyframes
// Behavior:
// - If keyframes are selected: keep only position keyframes selected (deselect all others)
// - If no keyframes selected but layers selected: select all position keyframes on those layers
// - If neither keyframes nor layers selected: select all position keyframes in the active composition
(function selectPositionKeyframes() {
var POS_ATTRS = ["position", "position.x", "position.y", "position.z"]; // guard for 2D/3D
var isPositionAttr = function(attrPath) {
if (!attrPath || typeof attrPath !== "string") return false;
var a = ("" + attrPath).toLowerCase();
if (a === "position") return true;
if (a.indexOf("position.") === 0) return true; // position.x/.y/.z
if (a.indexOf(".position") !== -1) return true; // e.g., transforms.position
if (a.indexOf("shapeposition") !== -1) return true; // some layer types
return false;
};
var uniq = function(arr) {
var m = {};
var out = [];
for (var i = 0; i < arr.length; i++) {
var v = arr[i];
if (!m[v]) { m[v] = true; out.push(v); }
}
return out;
};
var listPositionAttributes = function(layerId) {
var attrs = [];
// Prefer enumerating animated attrs to catch variant names
try {
var animated = (typeof api.getAnimatedAttributes === "function") ? (api.getAnimatedAttributes(layerId) || []) : [];
for (var i = 0; i < animated.length; i++) if (isPositionAttr(animated[i])) attrs.push(animated[i]);
} catch (_) {}
// Ensure common fallbacks are included
for (var j = 0; j < POS_ATTRS.length; j++) if (attrs.indexOf(POS_ATTRS[j]) === -1) attrs.push(POS_ATTRS[j]);