How to use the framesync.render function in framesync

To help you get started, we’ve selected a few framesync examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Popmotion / popmotion / packages / stylefire / src / styler / index.ts View on Github external
function setValue(key: string, value: any) {
    if (key.startsWith('--')) {
      props.hasCSSVariable = true;
    }
    const currentValue = state[key];
    state[key] = value;

    if (state[key] === currentValue) return;

    if (changedValues.indexOf(key) === -1) {
      changedValues.push(key);
    }

    if (!hasChanged) {
      hasChanged = true;
      sync.render(styler.render);
    }
  }
github aholachek / animate-css-grid / src / index.ts View on Github external
if (immediate) {
    styleEl();
  } else {
    sync.render(styleEl);
  }
  const firstChild = el.children[0] as HTMLElement;
  if (firstChild) {
    const styleChild = () => {
      firstChild.style.transform = isFinished
        ? ''
        : `scaleX(${1 / scaleX}) scaleY(${1 / scaleY})`;
    };
    if (immediate) {
      styleChild();
    } else {
      sync.render(styleChild);
    }
  }
};
github aholachek / animate-css-grid / src / index.ts View on Github external
const applyCoordTransform = (
  el: HTMLElement,
  { translateX, translateY, scaleX, scaleY }: Coords,
  { immediate }: { immediate?: boolean } = {}
): void => {
  const isFinished =
    translateX === 0 && translateY === 0 && scaleX === 1 && scaleY === 1;
  const styleEl = () => {
    el.style.transform = isFinished
      ? ''
      : `translateX(${translateX}px) translateY(${translateY}px) scaleX(${scaleX}) scaleY(${scaleY})`;
  };
  if (immediate) {
    styleEl();
  } else {
    sync.render(styleEl);
  }
  const firstChild = el.children[0] as HTMLElement;
  if (firstChild) {
    const styleChild = () => {
      firstChild.style.transform = isFinished
        ? ''
        : `scaleX(${1 / scaleX}) scaleY(${1 / scaleY})`;
    };
    if (immediate) {
      styleChild();
    } else {
      sync.render(styleChild);
    }
  }
};