Skip to content

Instantly share code, notes, and snippets.

View dokluch's full-sized avatar

Nik Ska dokluch

View GitHub Profile
@dokluch
dokluch / setDelta.gs
Created July 17, 2018 09:53
Copies expressions in Google Sheet on form submission
function setDelta(e) {
//Работает только для одометра
function setYesterDate(sheet, row, col){
//выставляет вчерашнюю дату
var MILLIS_PER_DAY = 1000 * 60 * 60 * 24;
var dateCell = col + String(row);
var today = new Date();
var yesterday = new Date(today.getTime() - MILLIS_PER_DAY);
@dokluch
dokluch / Create iOS Icons.jsx
Created December 4, 2016 16:03 — forked from twonjosh/Create iOS Icons.jsx
Photoshop Script to Create iOS Icons from a source image
// Photoshop Script to Create iPhone Icons from iTunesArtwork
//
// WARNING!!! In the rare case that there are name collisions, this script will
// overwrite (delete perminently) files in the same folder in which the selected
// iTunesArtwork file is located. Therefore, to be safe, before running the
// script, it's best to make sure the selected iTuensArtwork file is the only
// file in its containing folder.
//
// Copyright (c) 2010 Matt Di Pasquale
// Added tweaks Copyright (c) 2012 by Josh Jones http://www.appsbynight.com
@dokluch
dokluch / MarkerRepeat.jsx
Last active October 21, 2016 19:27
Сначала задать поведение свойства с нулевого кадра (например резкое изменение до 100 и плавный спуск до 0), и потом просто ставить маркеры на слое, чтобы вызывать это поведение
n = 0;
if (marker.numKeys > 0){
n = marker.nearestKey(time).index;
if (marker.key(n).time > time) n--; //проверка
}
if(n>0){
try{
t = time-marker.key(n).time; //время прошедшее с маркера
thisProperty.valueAtTime(t+thisProperty.key(1).time);
@dokluch
dokluch / removeOtherKeys.jsx
Created June 16, 2016 17:35
This snippet will remove every other key on a selected property starting from 0 or 1
//Remove every second keyframe for selected property
var start = 0; //Start with 0 or 1
var activeComp = app.project.activeItem;
if(activeComp && activeComp instanceof CompItem){
var sel = activeComp.selectedProperties;
if(sel.length > 0){
app.beginUndoGroup("Remove every 2nd");
@dokluch
dokluch / compareArrays.jsx
Created May 31, 2016 10:00
Перегружаем оператор сравнения для прототипа Array
var a = [1,2,3]
var b = [1,2,3]
Array.prototype["=="] = function(operand){
for(var i = 0; i < this.length; i++){
if(this[i] != operand[i]) return false;
}
return true;
}
@dokluch
dokluch / unParentAll.jsx
Last active April 27, 2016 14:01
Убирает вообще все паренты в проекте
for(var i = 1; i < app.project.items.length; i++){
app.beginUndoGroup("Unparent All");
if(app.project.items[i] instanceof CompItem){
unParentComp(app.project.items[i])
}
app.endUndoGroup();
}
function unParentComp(_comp){
@dokluch
dokluch / interpolateHold.jsx
Created February 17, 2016 15:00
Interpolates hold keyframes in After Effects
n = 0;
t = 0;
if (thisProperty.numKeys > 0){
n = thisProperty.nearestKey(time).index;
if (thisProperty.key(n).time > time) n--;
}
if(n < thisProperty.numKeys){
linear(time, thisProperty.key(n).time, thisProperty.key(n+1).time, thisProperty.key(n).value, thisProperty.key(n+1).value)
}
@dokluch
dokluch / connectWithShape.jsx
Created October 23, 2015 10:20
Скрипт для статичного соединения объектов шейпом
/*
Скрипт создает шейп, проходящий через position всех выбранных слоев
Не будет работать, если:
-слои прикреплены к другим слоям
-на позиции есть ключевые кадры/выражения
-Все в 3д и есть камеры
Все эти пункты легко исправляются по необходимости
Nik Ska, 2015
@dokluch
dokluch / findCompByName.jsx
Last active November 23, 2023 15:39
Finds a composition by a given name in Adobe After Effects
findCompByName=function(_name){
for(var i=1;i<=app.project.numItems;i++)
{
var curItem=app.project.item(i);
if (curItem.name==_name && curItem instanceof CompItem) return curItem;
}
return null;
}
@dokluch
dokluch / keyframeAccum.jsx
Last active August 29, 2015 14:23
Keyframe accumulator for After Effects
var audioSource = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");
var step = 1; // step in frames
var accum = 0;
if(audioSource.numKeys > 0){
var k = 0;
if(time >= step*2){