Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export anchors or allow anchor: Anchor | number for cleaner expressions #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

fartinmartin
Copy link

Say you have a Dropdown Menu Control to select the anchor for your eBox. As of now, after you create your control you'll have to derive the value like so:

const { createBox } = footage('eBox.jsx').sourceData;

const anchor = [
  'topLeft',
  'topCenter',
  'topRight',
  'bottomRight',
  'bottomCenter',
  'bottomLeft',
  'centerLeft',
  'center',
  'centerRight',
][effect("Anchor")(1) - 1];

const box = createBox({
  size: [800, 200],
  position: [960, 540],
  rounding: [12, 12, 12, 12],
  anchor: anchor,
});

box.getPath();

But! Imagine a world where you could:

const { createBox, anchors } = footage('eBox.jsx').sourceData;

const box = createBox({
  size: [800, 200],
  position: [960, 540],
  rounding: [12, 12, 12, 12],
  anchor: anchors[effect("Anchor")(1) - 1],
});

box.getPath();

fartinmartin@5b1305e


Or, if it doesn't make sense to export anchors, alternatively anchor could accept a number as well:

const { createBox } = footage('eBox.jsx').sourceData;

const box = createBox({
  size: [800, 200],
  position: [960, 540],
  rounding: [12, 12, 12, 12],
  anchor: effect("Anchor")(1).value,
});

box.getPath();

fartinmartin@4486eb6


Note: when testing center[Left|Right] anchors you'll run into #4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant