Skip to content

Instantly share code, notes, and snippets.

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/3c41b02f5abe3db122721486b65974dc to your computer and use it in GitHub Desktop.
Save david-littlefield/3c41b02f5abe3db122721486b65974dc to your computer and use it in GitHub Desktop.
[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
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");
var line_1_composition = comp("Preview");
var line_1_layer = line_1_composition.layer("Controller - Bottom Right Section");
var line_1_effect = line_1_layer.effect("Line 1");
var line_1_checkbox = line_1_effect("Checkbox");
var line_2_composition = comp("Preview");
var line_2_layer = line_2_composition.layer("Controller - Bottom Right Section");
var line_2_effect = line_2_layer.effect("Line 2");
var line_2_checkbox = line_2_effect("Checkbox");
var line_3_composition = comp("Preview");
var line_3_layer = line_3_composition.layer("Controller - Bottom Right Section");
var line_3_effect = line_3_layer.effect("Line 3");
var line_3_checkbox = line_3_effect("Checkbox");
var line_4_composition = comp("Preview");
var line_4_layer = line_4_composition.layer("Controller - Bottom Right Section");
var line_4_effect = line_4_layer.effect("Line 4");
var line_4_checkbox = line_4_effect("Checkbox");
var line_5_composition = comp("Preview");
var line_5_layer = line_5_composition.layer("Controller - Bottom Right Section");
var line_5_effect = line_5_layer.effect("Line 5");
var line_5_checkbox = line_5_effect("Checkbox");
var object_composition = comp("Bottom Right");
var object_layer = object_composition.layer("Title Background");
var object_position = object_layer.position;
var object_x_value = object_position[0];
var object_y_value = object_position[1];
var object_rectangle = object_layer.sourceRectAtTime();
var object_width = object_rectangle.width;
var object_height = object_rectangle.height;
var object_left = object_x_value - (object_width / 2);
var object_bottom = object_y_value + (object_height / 2);
var text_1_composition = comp("Bottom Right");
var text_1_layer = text_1_composition.layer("Point 1");
var text_1_properties = text_1_layer.text;
var text_1_source = text_1_properties.sourceText;
var text_1_style = text_1_source.style;
var text_1_size = text_1_style.fontSize;
var text_1_leading = text_1_style.autoLeading ? text_1_size * 1.2 : text_1_style.leading;
var text_1_rectangle = text_1_layer.sourceRectAtTime();
var text_1_height = text_1_rectangle.height;
var text_1_lines = line_1_checkbox == 1 ? Math.ceil(text_1_height / text_1_leading) : 0;
var text_1_lines_height = text_1_lines > 0 && line_1_checkbox == 1 ? text_1_size * text_1_lines : 0;
var text_1_x_height = text_1_lines > 0 && line_1_checkbox == 1 ? text_1_height / text_1_lines : 0;
var text_2_composition = comp("Bottom Right");
var text_2_layer = text_2_composition.layer("Point 2");
var text_2_properties = text_2_layer.text;
var text_2_source = text_2_properties.sourceText;
var text_2_style = text_2_source.style;
var text_2_size = text_2_style.fontSize;
var text_2_leading = text_2_style.autoLeading ? text_2_size * 1.2 : text_2_style.leading;
var text_2_rectangle = text_2_layer.sourceRectAtTime();
var text_2_height = text_2_rectangle.height;
var text_2_lines = line_2_checkbox == 1 ? Math.ceil(text_2_height / text_2_leading) : 0;
var text_2_lines_height = text_2_lines > 0 && line_2_checkbox == 1 ? text_2_size * text_2_lines : 0;
var text_2_x_height = text_2_lines > 0 && line_2_checkbox == 1 ? text_2_height / text_2_lines : 0;
var text_3_composition = comp("Bottom Right");
var text_3_layer = text_3_composition.layer("Point 3");
var text_3_properties = text_3_layer.text;
var text_3_source = text_3_properties.sourceText;
var text_3_style = text_3_source.style;
var text_3_size = text_3_style.fontSize;
var text_3_leading = text_3_style.autoLeading ? text_3_size * 1.2 : text_3_style.leading;
var text_3_rectangle = text_3_layer.sourceRectAtTime();
var text_3_height = text_3_rectangle.height;
var text_3_lines = line_3_checkbox == 1 ? Math.ceil(text_3_height / text_3_leading) : 0;
var text_3_lines_height = text_3_lines > 0 && line_3_checkbox == 1 ? text_3_size * text_3_lines : 0;
var text_3_x_height = text_3_lines > 0 && line_3_checkbox == 1 ? text_3_height / text_3_lines : 0;
var text_4_composition = comp("Bottom Right");
var text_4_layer = text_4_composition.layer("Point 4");
var text_4_properties = text_4_layer.text;
var text_4_source = text_4_properties.sourceText;
var text_4_style = text_4_source.style;
var text_4_size = text_4_style.fontSize;
var text_4_leading = text_4_style.autoLeading ? text_4_size * 1.2 : text_4_style.leading;
var text_4_rectangle = text_4_layer.sourceRectAtTime();
var text_4_height = text_4_rectangle.height;
var text_4_lines = line_4_checkbox == 1 ? Math.ceil(text_4_height / text_4_leading) : 0;
var text_4_lines_height = text_4_lines > 0 && line_4_checkbox == 1 ? text_4_size * text_4_lines : 0;
var text_4_x_height = text_4_lines > 0 && line_4_checkbox == 1 ? text_4_height / text_4_lines : 0;
var text_5_composition = comp("Bottom Right");
var text_5_layer = text_5_composition.layer("Point 5");
var text_5_properties = text_5_layer.text;
var text_5_source = text_5_properties.sourceText;
var text_5_style = text_5_source.style;
var text_5_size = text_5_style.fontSize;
var text_5_leading = text_5_style.autoLeading ? (text_5_size * 1.2) : text_5_style.leading;
var text_5_rectangle = text_5_layer.sourceRectAtTime();
var text_5_height = text_5_rectangle.height;
var text_5_lines = line_5_checkbox == 1 ? Math.ceil(text_5_height / text_5_leading) : 0;
var text_5_lines_height = text_5_lines > 0 && line_5_checkbox == 1 ? text_5_size * text_5_lines : 0;
var text_5_x_height = text_5_lines > 0 && line_5_checkbox == 1 ? text_5_height / text_5_lines : 0;
var x_value = object_left + text_1_size + (text_1_size / 2) + extra_horizontal_margin_slider;
var y_value = object_bottom + (text_1_size * 0.5) + (extra_vertical_margin_slider * line_1_checkbox);
y_value = y_value + text_1_lines_height + (text_1_size * 0.5 * line_1_checkbox) + (extra_vertical_margin_slider * line_2_checkbox);
y_value = y_value + text_2_lines_height + (text_2_size * 0.5 * line_2_checkbox) + (extra_vertical_margin_slider * line_3_checkbox);
y_value = y_value + text_3_lines_height + (text_3_size * 0.5 * line_3_checkbox) + (extra_vertical_margin_slider * line_4_checkbox);
y_value = y_value + text_4_lines_height + (text_4_size * 0.5 * line_4_checkbox) + (extra_vertical_margin_slider * line_5_checkbox);
[x_value, y_value];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment