Keyfast
Script
Free

Select Scale Keyframes

By Jack Vaughan
Updated 11/1/2025

About

Selects only scale keyframes on selected layers. Useful for quickly isolating scale animation when editing keyframes.

Code

// Cavalry Script: Keyfast - Select scale keyframes
(function selectScaleKeyframes() {
var SCALE_ATTRS = ["scale", "scale.x", "scale.y", "scale.z", "shapeScale"]; // common variants
var isScaleAttr = function(attrPath) {
if (!attrPath || typeof attrPath !== "string") return false;
var a = ("" + attrPath).toLowerCase();
if (a === "scale") return true;
if (a.indexOf("scale.") === 0) return true;
if (a.indexOf(".scale") !== -1) return true;
if (a.indexOf("shapescale") !== -1) return true;
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 listScaleAttributes = function(layerId) {
var attrs = [];
try { var animated = (typeof api.getAnimatedAttributes === "function") ? (api.getAnimatedAttributes(layerId) || []) : []; for (var i=0;i<animated.length;i++) if (isScaleAttr(animated[i])) attrs.push(animated[i]); } catch (_) {}
for (var j=0;j<SCALE_ATTRS.length;j++) if (attrs.indexOf(SCALE_ATTRS[j]) === -1) attrs.push(SCALE_ATTRS[j]);
return attrs;
};
var getScaleKeyIdsForLayer = function(layerId) {
var ids = [];
var scAttrs = listScaleAttributes(layerId);
for (var i=0;i<scAttrs.length;i++) {
var attr = scAttrs[i];
try {
var kIds = (typeof api.getKeyframeIdsForAttribute === "function") ? (api.getKeyframeIdsForAttribute(layerId, attr) || []) : [];
for (var k=0;k<kIds.length;k++) ids.push(kIds[k]);
} catch (_) {}
}
return ids;
};
var selectedKeyIds = [];