zoukankan      html  css  js  c++  java
  • [TypeStyle] Use TypeStyle keyframes to create CSS animations

    We cover CSS keyframes and how to create them using TypeStyle. We then show how to use the keyframes function to create an animation. We also discuss a few other CSS properties in the animation namespace.

    import {style, keyframes, classes} from 'typestyle';
    import * as React from 'react';
    import * as ReactDOM from 'react-dom';
    
    const fadeAnimationName = keyframes({
        from: {opacity: 0},
        to: {opacity: 1}
    });
    const fadeAnimationClassName = style({
        animationName: fadeAnimationName,
        animationDuration: '2s'
    });
    
    const coloringAnimationName = keyframes({
        '0%': {color: 'black'},
        '50%': {color: 'pink'},
        '100%': {color: 'red'}
    });
    const fontColoringAnimationClassName = style({
        fontSize: '20px',
        animationName: coloringAnimationName,
        animationDuration: '2s',
        animationIterationCount: 'infinite'
    });
    
    const App = () => (
        <div className={classes(
            fadeAnimationClassName,
            fontColoringAnimationClassName
        )}>
            Hello World!
        </div>
    
    );
    
    ReactDOM.render(
        <App />,
        document.getElementById('root')
    );
  • 相关阅读:
    十三.基础邮件服务、parted分区工具、交换分区、链路聚合
    十二.虚拟Web主机
    十一.简单MariaDB数据库的管理
    十.iSCSI网络磁盘
    九.配置SMB共享(Samba共享)
    八.防火墙相关操作
    bzoj3132
    bzoj4753
    codeforces round #418 div 2
    ural1519
  • 原文地址:https://www.cnblogs.com/Answer1215/p/6954416.html
Copyright © 2011-2022 走看看