[TypeStyle] Use TypeStyle keyframes to create CSS animations
CSS to create use
2023-09-14 08:59:18 时间
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') );
相关文章
- CSS - 工具类 tool.css
- 第八十六节,html5+css3pc端固定布局,网站结构,CSS选择器,完成导航
- [CSS] Purgecss to remove unused css
- [CSS] Use CSS Variables with Calc and HSL to Implement Dark Mode
- [CSS] Place Images with object-position
- [CSS3] Use media query to split css files and Dark mode (prefers-color-scheme: dark)
- [CSS3] Make a One-time CSS Animation that Does Not Revert to its Original Style
- [css]演示:纯CSS实现的右侧底部简洁悬浮效果
- [CSS 3] Apply Aspect Ratio Sizing to Images with CSS object-fit
- [CSS] Use CSS Transforms to Create Configurable 3D Cuboids
- [CSS] Use CSS Variables Almost like Boolean Values with Calc (maintainable css)
- [CSS 3] Use Multiple Background Images to Create Single Element CSS Art
- [CSS3] Use media query to split css files and Dark mode (prefers-color-scheme: dark)
- [CSS] Introduction to CSS Columns
- [CSS] :not Selector
- 成功解决To fix this you could try to: 1. loosen the range of package versions you‘ve specified
- 前端性能优化—将CSS文件放在顶部
- 【CSS】课程网站头部制作 ④ ( 搜索栏按钮测量 | 搜索栏按钮代码编写 | 代码示例 )
- 【CSS】课程网站头部制作 ② ( 导航栏测量 | 导航栏编写 | 代码示例 )
- CSS_使用css布局
- PAT 1033. To Fill or Not to Fill (贪心)
- CSS背景图片自适应 根据浏览器分辨率大小自动伸缩
- div+css命名规范(转载)