当前位置: 首页>>代码示例>>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;未经允许,请勿转载。