本文整理匯總了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();