當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript utils.addEvent函數代碼示例

本文整理匯總了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);
}
開發者ID:daybrush,項目名稱:scenejs,代碼行數:29,代碼來源:utils.ts

示例2: toArray

toArray($(".page2 li .feature", true)).forEach(el => {
    addEvent(el, "click", e => {
        e.preventDefault();
    });
});
開發者ID:daybrush,項目名稱:scenejs,代碼行數:5,代碼來源:FeaturesPage.ts

示例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;
    }
開發者ID:daybrush,項目名稱:scenejs,代碼行數:31,代碼來源:Header.ts

示例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();
開發者ID:daybrush,項目名稱:scenejs,代碼行數:32,代碼來源:MainPage.ts


注:本文中的@daybrush/utils.addEvent函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。