MCPcopy Index your code
hub / github.com/ampproject/amphtml / animateFixedElements

Method animateFixedElements

src/service/fixed-layer.js:884–904  ·  view source on GitHub ↗

* @param {number} paddingTop * @param {number} lastPaddingTop * @param {number} duration * @param {string} curve * @param {boolean} transient * @return {!Promise}

(paddingTop, lastPaddingTop, duration, curve, transient)

Source from the content-addressed store, hash-verified

882 * @return {!Promise}
883 */
884 animateFixedElements(paddingTop, lastPaddingTop, duration, curve, transient) {
885 this.updatePaddingTop(paddingTop, transient);
886 if (duration <= 0) {
887 return Promise.resolve();
888 }
889 // Add transit effect on position fixed element
890 const tr = (time) => {
891 return lastPaddingTop - paddingTop + (paddingTop - lastPaddingTop) * time;
892 };
893 return Animation.animate(
894 this.ampdoc.getRootNode(),
895 (time) => {
896 const p = tr(time);
897 this.transformMutate(`translateY(${p}px)`);
898 },
899 duration,
900 curve
901 ).thenAlways(() => {
902 this.transformMutate(null);
903 });
904 }
905}
906
907/**

Callers 2

Calls 7

updatePaddingTopMethod · 0.95
transformMutateMethod · 0.95
resolveMethod · 0.80
animateMethod · 0.80
trFunction · 0.50
thenAlwaysMethod · 0.45
getRootNodeMethod · 0.45

Tested by

no test coverage detected