Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@david-littlefield
Created April 30, 2022 03:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save david-littlefield/f6ff615f9d3808df410da1128b9c4372 to your computer and use it in GitHub Desktop.
Save david-littlefield/f6ff615f9d3808df410da1128b9c4372 to your computer and use it in GitHub Desktop.
[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
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");
var text_field_width_control_composition = comp("Input");
var text_field_width_control_layer = text_field_width_control_composition.layer("Controller - All");
var text_field_width_control_effect = text_field_width_control_layer.effect("Text Field Width");
var text_field_width_control_slider = text_field_width_control_effect("Slider");
var text_field_height_control_composition = comp("Input");
var text_field_height_control_layer = text_field_height_control_composition.layer("Controller - All");
var text_field_height_control_effect = text_field_height_control_layer.effect("Text Field Height");
var text_field_height_control_slider = text_field_height_control_effect("Slider");
var font_size_control_composition = comp("Input");
var font_size_control_layer = font_size_control_composition.layer("Controller - All");
var font_size_control_effect = font_size_control_layer.effect("Font Size");
var font_size_control_slider = font_size_control_effect("Slider");
var controller_composition = comp("Input");
var controller_composition_width = controller_composition.width;
var controller_composition_height = controller_composition.height;
var controller_layer = controller_composition.layer("Controller - All");
var controller_rectangle = controller_layer.sourceRectAtTime();
var controller_left = controller_rectangle.left;
var controller_top = controller_rectangle.top;
var controller_width = controller_rectangle.width;
var controller_height = controller_rectangle.height;
var controller_anchor_point_x_value = controller_left + (controller_width * 0.5);
var controller_anchor_point_y_value = controller_top + (controller_height * 0.5);
var title_composition = comp("Input");
var title_layer = title_composition.layer("Title");
var title_properties = title_layer.text;
var title_source = title_properties.sourceText;
var title_style = title_source.style;
var title_size = title_style.fontSize;
var title_leading = title_style.autoLeading ? (title_size * 1.2) : title_style.leading;
var title_rectangle = title_layer.sourceRectAtTime();
var title_left = title_rectangle.left;
var title_top = title_rectangle.top;
var title_width = title_rectangle.width;
var title_height = title_rectangle.height;
var title_lines = Math.ceil(title_height / title_leading);
var title_lines_height = title_size * title_lines;
var title_x_height = title_height / title_lines;
var title_anchor_point_x_value = title_left;
var title_anchor_point_y_value = title_top;
var subtitle_composition = comp("Input");
var subtitle_layer = subtitle_composition.layer("Subtitle");
var subtitle_properties = subtitle_layer.text;
var subtitle_source = subtitle_properties.sourceText;
var subtitle_style = subtitle_source.style;
var subtitle_size = subtitle_style.fontSize;
var subtitle_leading = subtitle_style.autoLeading ? (subtitle_size * 1.2) : subtitle_style.leading;
var subtitle_rectangle = subtitle_layer.sourceRectAtTime();
var subtitle_left = subtitle_rectangle.left;
var subtitle_top = subtitle_rectangle.top;
var subtitle_width = subtitle_rectangle.width;
var subtitle_height = subtitle_rectangle.height;
var subtitle_lines = Math.ceil(subtitle_height / subtitle_leading);
var subtitle_lines_height = subtitle_size * subtitle_lines;
var subtitle_x_height = subtitle_height / subtitle_lines;
var subtitle_anchor_point_x_value = subtitle_left;
var subtitle_anchor_point_y_value = subtitle_top;
var font_name_composition = comp("Input");
var font_name_layer = font_name_composition.layer("Font Name");
var font_name_properties = font_name_layer.text;
var font_name_source = font_name_properties.sourceText;
var font_name_style = font_name_source.style;
var font_name_size = font_name_style.fontSize;
var font_name_leading = font_name_style.autoLeading ? (font_name_size * 1.2) : font_name_style.leading;
var font_name_rectangle = font_name_layer.sourceRectAtTime();
var font_name_left = font_name_rectangle.left;
var font_name_top = font_name_rectangle.top;
var font_name_width = font_name_rectangle.width;
var font_name_height = font_name_rectangle.height;
var font_name_lines = Math.ceil(font_name_height / font_name_leading);
var font_name_lines_height = font_name_size * font_name_lines;
var font_name_x_height = font_name_height / font_name_lines;
var font_name_anchor_point_x_value = font_name_left;
var font_name_anchor_point_y_value = font_name_top;
var title_label_composition = comp("Input");
var title_label_layer = title_label_composition.layer("Title Label");
var title_label_properties = title_label_layer.text;
var title_label_source = title_label_properties.sourceText;
var title_label_style = title_label_source.style;
var title_label_size = title_label_style.fontSize;
var title_label_leading = title_label_style.autoLeading ? (title_label_size * 1.2) : title_label_style.leading;
var title_label_rectangle = title_label_layer.sourceRectAtTime();
var title_label_left = title_label_rectangle.left;
var title_label_top = title_label_rectangle.top;
var title_label_width = title_label_rectangle.width;
var title_label_height = title_label_rectangle.height;
var title_label_lines = Math.ceil(title_label_height / title_label_leading);
var title_label_lines_height = title_label_size * title_label_lines;
var title_label_x_height = title_label_height / title_label_lines;
var title_label_anchor_point_x_value = title_label_left;
var title_label_anchor_point_y_value = title_label_top;
var subtitle_label_composition = comp("Input");
var subtitle_label_layer = subtitle_label_composition.layer("Subtitle Label");
var subtitle_label_properties = subtitle_label_layer.text;
var subtitle_label_source = subtitle_label_properties.sourceText;
var subtitle_label_style = subtitle_label_source.style;
var subtitle_label_size = subtitle_label_style.fontSize;
var subtitle_label_leading = subtitle_label_style.autoLeading ? (subtitle_label_size * 1.2) : subtitle_label_style.leading;
var subtitle_label_rectangle = subtitle_label_layer.sourceRectAtTime();
var subtitle_label_left = subtitle_label_rectangle.left;
var subtitle_label_top = subtitle_label_rectangle.top;
var subtitle_label_width = subtitle_label_rectangle.width;
var subtitle_label_height = subtitle_label_rectangle.height;
var subtitle_label_lines = Math.ceil(subtitle_label_height / subtitle_label_leading);
var subtitle_label_lines_height = subtitle_label_size * subtitle_label_lines;
var subtitle_label_x_height = subtitle_label_height / subtitle_label_lines;
var subtitle_label_anchor_point_x_value = subtitle_label_left;
var subtitle_label_anchor_point_y_value = subtitle_label_top;
var font_name_label_composition = comp("Input");
var font_name_label_layer = font_name_label_composition.layer("Font Name Label");
var font_name_label_properties = font_name_label_layer.text;
var font_name_label_source = font_name_label_properties.sourceText;
var font_name_label_style = font_name_label_source.style;
var font_name_label_size = font_name_label_style.fontSize;
var font_name_label_leading = font_name_label_style.autoLeading ? (font_name_label_size * 1.2) : font_name_label_style.leading;
var font_name_label_rectangle = font_name_label_layer.sourceRectAtTime();
var font_name_label_left = font_name_label_rectangle.left;
var font_name_label_top = font_name_label_rectangle.top;
var font_name_label_width = font_name_label_rectangle.width;
var font_name_label_height = font_name_label_rectangle.height;
var font_name_label_lines = Math.ceil(font_name_label_height / font_name_label_leading);
var font_name_label_lines_height = font_name_label_size * font_name_label_lines;
var font_name_label_x_height = font_name_label_height / font_name_label_lines;
var font_name_label_anchor_point_x_value = font_name_label_left;
var font_name_label_anchor_point_y_value = font_name_label_top;
var title_background_composition = comp("Input");
var title_background_layer = title_background_composition.layer("Title Background");
var title_background_position = title_background_layer.position;
var title_background_x_value = title_background_position[0];
var title_background_y_value = title_background_position[1];
var title_background_rectangle = title_background_layer.sourceRectAtTime();
var title_background_left = title_background_rectangle.left;
var title_background_top = title_background_rectangle.top;
var title_background_width = title_background_rectangle.width;
var title_background_height = title_background_rectangle.height;
var title_background_anchor_point_x_value = title_background_left + (title_background_width * 0.5);
var title_background_anchor_point_y_value = title_background_top + (title_background_height * 0.5);
var subtitle_background_composition = comp("Input");
var subtitle_background_layer = subtitle_background_composition.layer("Subtitle Background");
var subtitle_background_position = subtitle_background_layer.position;
var subtitle_background_x_value = subtitle_background_position[0];
var subtitle_background_y_value = subtitle_background_position[1];
var subtitle_background_rectangle = subtitle_background_layer.sourceRectAtTime();
var subtitle_background_left = subtitle_background_rectangle.left;
var subtitle_background_top = subtitle_background_rectangle.top;
var subtitle_background_width = subtitle_background_rectangle.width;
var subtitle_background_height = subtitle_background_rectangle.height;
var subtitle_background_anchor_point_x_value = subtitle_background_left + (subtitle_background_width * 0.5);
var subtitle_background_anchor_point_y_value = subtitle_background_top + (subtitle_background_height * 0.5);
var font_name_background_composition = comp("Input");
var font_name_background_layer = font_name_background_composition.layer("Font Name Background");
var font_name_background_position = font_name_background_layer.position;
var font_name_background_x_value = font_name_background_position[0];
var font_name_background_y_value = font_name_background_position[1];
var font_name_background_rectangle = font_name_background_layer.sourceRectAtTime();
var font_name_background_left = font_name_background_rectangle.left;
var font_name_background_top = font_name_background_rectangle.top;
var font_name_background_width = font_name_background_rectangle.width;
var font_name_background_height = font_name_background_rectangle.height;
var font_name_background_anchor_point_x_value = font_name_background_left + (font_name_background_width * 0.5);
var font_name_background_anchor_point_y_value = font_name_background_top + (font_name_background_height * 0.5);
var background_composition = comp("Input");
var background_composition_width = background_composition.width;
var background_composition_height = background_composition.height;
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_left = background_rectangle.left;
var background_top = background_rectangle.top;
var background_width = background_rectangle.width;
var background_height = background_rectangle.height;
var background_anchor_point_x_value = background_left + (background_width * 0.5);
var background_anchor_point_y_value = background_top + (background_height * 0.5);
var controller_position_x_value = controller_composition_width * 0.5;
var controller_position_y_value = controller_composition_height * 0.5;
var title_position_x_value = title_background_x_value - (title_background_width * 0.5) + (padding_control_slider * 2.0);
var title_position_y_value = title_background_y_value - (title_background_height * 0.5) + (title_background_height - title_height) * 0.5;
var subtitle_position_x_value = subtitle_background_x_value - (subtitle_background_width * 0.5) + (padding_control_slider * 2.0);
var subtitle_position_y_value = subtitle_background_y_value - (subtitle_background_height * 0.5) + (subtitle_background_height - subtitle_height) * 0.5;
var font_name_position_x_value = font_name_background_x_value - (font_name_background_width * 0.5) + (padding_control_slider * 2.0);
var font_name_position_y_value = font_name_background_y_value - (font_name_background_height * 0.5) + (font_name_background_height - font_name_height) * 0.5;
var title_label_position_x_value = title_background_x_value - (title_background_width * 0.5);
var title_label_position_y_value = title_background_y_value - (title_background_height * 0.5) - padding_control_slider - title_label_height;
var subtitle_label_position_x_value = subtitle_background_x_value - (subtitle_background_width * 0.5);
var subtitle_label_position_y_value = subtitle_background_y_value - (subtitle_background_height * 0.5) - padding_control_slider - subtitle_label_height;
var font_name_label_position_x_value = font_name_background_x_value - (font_name_background_width * 0.5);
var font_name_label_position_y_value = font_name_background_y_value - (font_name_background_height * 0.5) - padding_control_slider - font_name_label_height;
var title_background_position_x_value = background_x_value - (background_width * 0.5) + margin_control_slider + (text_field_width_control_slider * 0.5);
var title_background_position_y_value = background_y_value - (background_height * 0.5) + (margin_control_slider * 1) + (text_field_height_control_slider * 0.5) + font_size_control_slider;
var subtitle_background_position_x_value = background_x_value - (background_width * 0.5) + margin_control_slider + (text_field_width_control_slider * 0.5);
var subtitle_background_position_y_value = background_y_value - (background_height * 0.5) + (margin_control_slider * 2) + (text_field_height_control_slider * 1.5) + font_size_control_slider;
var font_name_background_position_x_value = background_x_value - (background_width * 0.5) + margin_control_slider + (text_field_width_control_slider * 0.5);
var font_name_background_position_y_value = background_y_value - (background_height * 0.5) + (margin_control_slider * 3.0) + (text_field_height_control_slider * 2.5) + font_size_control_slider;
var background_position_x_value = background_composition_width * 0.5;
var background_position_y_value = background_composition_height * 0.5;
var title_background_size_width = text_field_width_control_slider;
var title_background_size_height = text_field_height_control_slider;
var subtitle_background_size_width = text_field_width_control_slider;
var subtitle_background_size_height = text_field_height_control_slider;
var font_name_background_size_width = text_field_width_control_slider;
var font_name_background_size_height = text_field_height_control_slider;
var background_size_width = (margin_control_slider * 2.0) + text_field_width_control_slider;
var background_size_height = (margin_control_slider * 4.0) + (text_field_height_control_slider * 3.0) + font_size_control_slider;
[value_1, value_2];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment