Framestore Interview Question

Basic coding question regarding how I would handle the logic