本文整理汇总了TypeScript中@daybrush/utils.addEvent函数的典型用法代码示例。如果您正苦于以下问题:TypeScript addEvent函数的具体用法?TypeScript addEvent怎么用?TypeScript addEvent使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addEvent函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: addAnimationEvent
export function addAnimationEvent(item: Scene | SceneItem, el: Element) {
const state = item.state;
const duration = item.getDuration();
const isZeroDuration = !duration || !isFinite(duration);
const animationend = () => {
setPlayCSS(item, false);
item.finish();
};
const animationstart = () => {
item.trigger(PLAY);
};
item.once(ENDED, () => {
removeEvent(el, "animationcancel", animationend);
removeEvent(el, "animationend", animationend);
removeEvent(el, "animationiteration", animationiteration);
removeEvent(el, "animationstart", animationstart);
});
const animationiteration = ({ elapsedTime }: any) => {
const currentTime = elapsedTime;
const iterationCount = isZeroDuration ? 0 : (currentTime / duration);
state[CURRENT_TIME] = currentTime;
item.setIteration(iterationCount);
};
addEvent(el, "animationcancel", animationend);
addEvent(el, "animationend", animationend);
addEvent(el, "animationiteration", animationiteration);
addEvent(el, "animationstart", animationstart);
}
示例2: toArray
toArray($(".page2 li .feature", true)).forEach(el => {
addEvent(el, "click", e => {
e.preventDefault();
});
});
示例3: scroll
},
});
menu.addEventListener("click", e => {
e.preventDefault();
scroll(page.getRect(true).top);
exitNav();
});
});
$("header .logo").addEventListener("click", e => {
e.preventDefault();
scroll(pages[0].getRect(true).top);
exitNav();
});
addEvent(nav, "click", e => {
if (e.target === nav) {
exitNav();
}
});
addEvent(navButon, "click", () => {
if (hasClass(body, "navigate")) {
exitNav();
} else {
enterNav();
}
});
pages.forEach((page, i) => {
if (i % 2 === 0) {
return;
}
示例4: addEvent
{
"./clapper.mp3": {
[nextStep3 + 0.9]: {
seek: [0, 1],
playSpeed: 2,
volume: 0.7,
},
options: {
element: clapperSound,
},
},
},
);
addEvent($<HTMLElement>(".play_btn.front"), "click", () => {
scene.playCSS(false);
mediaScene.play();
});
const page1 = new Page(".page.page1");
page1.range(["10%", "90%"]).on({
firstEnter: () => {
scene.exportCSS();
},
enter: () => {
scene.playCSS(false);
mediaScene.play();
},
});
page1.on("exit", () => {
scene.finish();
mediaScene.finish();