View usefuleIncludes.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function includes() { | |
(function IncludeIsArray() { | |
if (!Array.isArray) { | |
Array.isArray = function (arg) { | |
return Object.toString.call(arg) === "[object Array]"; | |
}; | |
} | |
})(); | |
(function includeJSON() { |
View mouse.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Mouse = new (function () { | |
var mouse = this; | |
this.last = 0; | |
this.setLeft = function () { | |
mouse.last = 0; | |
}; | |
this.setMiddle = function () { | |
mouse.last = 1; | |
}; |
View genRand.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function genRand(min, max, decimalPlaces) { | |
// you could add some error checking to make sure all arguments exist | |
var result = Math.random() * (max - min) + min; | |
if (decimalPlaces > 0) { | |
var power = Math.pow(10, decimalPlaces); | |
var result = Math.floor(result * power) / power; | |
} | |
if (decimalPlaces === 0) { | |
result = Math.round(result); |
View lerp.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function lerp(start, end, amt) { | |
if (start == undefined || end == undefined || amt == undefined) { | |
// can't lerp, start end amount is missing | |
if (start !== undefined) { | |
return start; | |
} | |
return 0; | |
} | |
function oneDLerp(start, end, amt) { |
View filterColorProps.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function FilterColorProperties(propsArray) { | |
var result = []; | |
//getting selected colors... | |
var propsArray = | |
propsArray == undefined ? (app.project.activeItem.selectedProperties || []) : propsArray; | |
if (!propsArray || !propsArray.length) { | |
// no selected colors because no properties are selected | |
return result; | |
} |
View freezeLayerAtTime.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function freezeLayerAtCurrentTime(layer, specificTime) { | |
if (!layer) { | |
// no layer | |
return false | |
}; | |
try{ | |
layer.timeRemapEnabled = true; | |
var timeRemapProp = layer("ADBE Time Remapping"); |
View separateGroupsAndProperties.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function separateGroupsAndProperties (propsArray) { | |
// sorting an array of props to props an group... return an object | |
var resultObject = { | |
all: [], | |
props: [], | |
groups: [], | |
indexedGroups: [], | |
}; |
View getItemsByName.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function GetItemsByName (nameString) { | |
// returns array of found matches | |
if (!nameString) { | |
return false; | |
} | |
var matches = []; | |
for (var i = 1; i <= app.project.numItems; i++) { | |
var crnt = app.project.item(i); | |
var crntName = crnt.name; |
View checkGumroadLicense.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function GumrdLicenseRequest(licenseKeyInput, incrementUseCount, showDialogs) { | |
// better check here if there is access to files and network | |
var showDialogs = (showDialogs == undefined) ? true : showDialogs; | |
licenseKeyInput == undefined ? undefined : licenseKeyInput; | |
incrementUseCount == undefined ? false : String(incrementUseCount); | |
if ( |
View pressed.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pressed = new (function () { | |
this.shift = function () { | |
if (ScriptUI.environment.keyboardState.shiftKey) { | |
return true; | |
} | |
return false; | |
}; | |
this.alt = function () { | |
if (ScriptUI.environment.keyboardState.altKey) { | |
return true; |
NewerOlder