Skip to content

Instantly share code, notes, and snippets.

Avatar

David Littlefield david-littlefield

View GitHub Profile
View miscellaneous_extendscript_js_code.jsx
#include "/Users/david/Desktop/input_composition.jsx";
#include "/Users/david/Desktop/current_workspace.jsx";
function create_json_file(object) {
var text = JSON.stringify(object);
var file = new File("~/Desktop/input_composition_cache.json");
file.encoding = "utf-8";
file.open("w");
file.write(text);
file.close();
@david-littlefield
david-littlefield / 6_title_controls.js
Created May 1, 2022
[6 Title Controls] Provides user interface for 5 text field controls. #after_effects #anchor_point #position #size #text_field #title
View 6_title_controls.js
var margin_control_composition = comp("Input");
var margin_control_layer = margin_control_composition.layer("Controller - All");
var margin_control_effect = margin_control_layer.effect("Margin");
var margin_control_slider = margin_control_effect("Slider");
var padding_control_composition = comp("Input");
var padding_control_layer = padding_control_composition.layer("Controller - All");
var padding_control_effect = padding_control_layer.effect("Padding");
var padding_control_slider = padding_control_effect("Slider");
@david-littlefield
david-littlefield / input_composition.js
Created Apr 30, 2022
[Title, Subtitle, Font Name Input Composition] Provides text field input for title, subtitle, and font name. #after_effects #size #position #anchor_point #vertical #horizontal #composition
View input_composition.js
var margin_control_composition = comp("Input");
var margin_control_layer = margin_control_composition.layer("Controller - All");
var margin_control_effect = margin_control_layer.effect("Margin");
var margin_control_slider = margin_control_effect("Slider");
var padding_control_composition = comp("Input");
var padding_control_layer = padding_control_composition.layer("Controller - All");
var padding_control_effect = padding_control_layer.effect("Padding");
var padding_control_slider = padding_control_effect("Slider");
@david-littlefield
david-littlefield / automatically_center_logo_title_subtitle.js
Created Apr 28, 2022
[Automatically Center Logo, Title, and Subtitle] Centers logo, title, and subtitle based on whether logo, title, or subtitle is hidden. #after_effects #scale #center #position #horizontal #vertical #logo #title #subtitle
View automatically_center_logo_title_subtitle.js
var extra_horizontal_margin_composition = comp("Preview");
var extra_horizontal_margin_layer = extra_horizontal_margin_composition.layer("Controller - All Objects");
var extra_horizontal_margin_effect = extra_horizontal_margin_layer.effect("Extra Horizontal Margin");
var extra_horizontal_margin_slider = extra_horizontal_margin_effect("Slider");
var extra_vertical_margin_composition = comp("Preview");
var extra_vertical_margin_layer = extra_vertical_margin_composition.layer("Controller - All Objects");
var extra_vertical_margin_effect = extra_vertical_margin_layer.effect("Extra Vertical Margin");
var extra_vertical_margin_slider = extra_vertical_margin_effect("Slider");
@david-littlefield
david-littlefield / automatically_reposition_bullet_points_based_on_text.js
Last active Apr 27, 2022
[Automatically Reposition Bullet Points Based on Text] Repositions bullet point and text point for five items that adjusts for missing text. #after_effects #position #bullet_point #list #vertical
View automatically_reposition_bullet_points_based_on_text.js
var extra_horizontal_margin_composition = comp("Preview");
var extra_horizontal_margin_layer = extra_horizontal_margin_composition.layer("Controller - Top Left Section");
var extra_horizontal_margin_effect = extra_horizontal_margin_layer.effect("Extra Horizontal Margin");
var extra_horizontal_margin_slider = extra_horizontal_margin_effect("Slider");
var extra_vertical_margin_composition = comp("Preview");
var extra_vertical_margin_layer = extra_vertical_margin_composition.layer("Controller - Bottom Right Section");
var extra_vertical_margin_effect = extra_vertical_margin_layer.effect("Extra Vertical Margin");
var extra_vertical_margin_slider = extra_vertical_margin_effect("Slider");
@david-littlefield
david-littlefield / attach_title_background_to_top_of_background_card.js
Created Apr 25, 2022
[Attach Title Background to Top of Background Card] Sets position of title background to top of background card. #after_effects #title #background #title_background #top #position
View attach_title_background_to_top_of_background_card.js
// Transform Position
var background_composition = comp("Top Left");
var background_layer = background_composition.layer("Background");
var background_position = background_layer.position;
var background_x_value = background_position[0];
var background_y_value = background_position[1];
var background_rectangle = background_layer.sourceRectAtTime();
var background_width = background_rectangle.width;
var background_height = background_rectangle.height;
var background_top = background_y_value - (background_height / 2);
@david-littlefield
david-littlefield / resize_background_to_fit_text_with_descenders.js
Created Apr 21, 2022
[Resize Background to Fit Text With Descenders] Resizes vertical and horizontal background to fit text while adjusting height to accommodate descenders. #after_effects #resize #horizontal #vertical #text #object #background #size #height #descenders
View resize_background_to_fit_text_with_descenders.js
var padding_composition = comp("Preview");
var padding_layer = padding_composition.layer("Controller");
var padding_effect = padding_layer.effect("Padding");
var padding_slider = padding_effect("Slider");
var text_composition = comp("Top Right");
var text_layer = text_composition.layer("Label");
var text_properties = text_layer.text;
var text_source = text_properties.sourceText;
var text_style = text_source.style;
@david-littlefield
david-littlefield / match_right_object_to_height_of_left_object_while_adjusting_right_padding.js
Created Apr 17, 2022
[Match Right Object to Height of Left Object While Adjusting Right Padding] Increases or decreases right object to match height of left object while aligning right object to right margin. #after_effects #resize #horizontal #vertical #center #position #object #margin
View match_right_object_to_height_of_left_object_while_adjusting_right_padding.js
// Transform
var margin = thisComp.layer("Controller").effect("Margin")("Slider");
var object_composition = comp("Right Object");
var object_composition_width = object_composition.width;
var object_layer = object_composition.layer("Object");
var object_scale = object_layer.scale[0] / 100;
var object_rectangle = object_layer.sourceRectAtTime();
var object_width = object_rectangle.width * object_scale;
@david-littlefield
david-littlefield / scale_object_to_match_height_of_card.js
Created Apr 17, 2022
[Scale Object to Match Height of Card] Increases or decreases size of object to match the height of card. #after_effects #scale #vertical #card #object
View scale_object_to_match_height_of_card.js
// Scale
var card_layer = comp("Left").layer("Card");
var card_rectangle = card_layer.sourceRectAtTime();
var card_height = card_rectangle.height;
var object_layer = thisComp.layer("Object");
var object_rectangle = object_layer.sourceRectAtTime();
var object_height = object_rectangle.height;
@david-littlefield
david-littlefield / left_center_anchor_point.js
Last active Apr 16, 2022
[Left Center Anchor Point] Places anchor point at left center of object. #after_effects #left #center #anchor_point #horizontal #vertical
View left_center_anchor_point.js
// Transform > Anchor Point > Code
var object_layer = thisComp.layer("Subtitle");
var object_rectangle = object_layer.sourceRectAtTime();
var object_left = object_rectangle.left;
var object_top = object_rectangle.top;
var object_width = object_rectangle.width;
var object_height = object_rectangle.height;
var x_value = object_left;
var y_value = object_top + (object_height / 2);