[React] Animate your user interface in React with styled-components and "keyframes"
In this lesson, we learn how to handle CSS keyframe animations in styled-components, via the 'keyframes' helper.
import React from "react";
import styled, { keyframes } from "styled-components"; const morph = keyframes`
% { border-radius: 5px; }
% { border-radius: %; }
% { border-radius: 5px; }
`; const spin = keyframes`
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
`; const Ball = styled.div`
width: 64px;
height: 64px;
border-radius: %;
margin: auto;
background-color: #08aeea;
background-image: linear-gradient(0deg, #08aeea %, #2af598 %);
animation: ${morph} 1s linear infinite, ${spin} 1s ease-in-out infinite;
`; const App = () => <Ball />; export default App;
[React] Animate your user interface in React with styled-components and "keyframes"的更多相关文章
- React学习笔记-1-什么是react,react环境搭建以及第一个react实例
什么是react?react的官方网站:https://facebook.github.io/react/下图这个就是就是react的标志,非常巧合的是他和我们的github的编辑器Atom非常相似. ...
- [React] Intro to inline styles in React components
React lets you use "inline styles" to style your components; inline styles in React are ju ...
- React系列(一):React入门
React简介 1.由来 React是有Facebook开发出来用于构建前端界面的JS组件库,由于其背后的强大背景,使得这款库在技术开发上完全没有问题. 2.React的优势 解决大规模项目开发中数据 ...
- React Native是一套使用 React 构建 Native app 的编程框架
React Native是一套使用 React 构建 Native app 的编程框架 React Native at first sight what is React Native? 跟据官方的描 ...
- react.js 从零开始(七)React (虚拟)DOM
React 元素 React 中最主要的类型就是 ReactElement.它有四个属性:type,props,key 和ref.它没有方法,并且原型上什么都没有. 可以通过 React.create ...
- 如何使用TDD和React Testing Library构建健壮的React应用程序
如何使用TDD和React Testing Library构建健壮的React应用程序 当我开始学习React时,我努力的一件事就是以一种既有用又直观的方式来测试我的web应用程序. 每次我想测试它时 ...
- React环境配置(第一个React项目)
使用Webpack构建React项目 1. 使用NPM配置React环境 NPM及React安装自行百度 首先创建一个文件夹,the_first_React 进入到创建好的目录,npm init,然后 ...
- React入门介绍(2)- React Component-React组件
React Component-React组件 允许用户自由封装组件是React非常突出的特性,用户可将自己创建的组件像普通的HTML标签一样插入页面,React.CreateClass方法就是用来创 ...
- react的类型检查PropTypes自React v15.5起已弃用,请使用prop-types
最近使用React的类型检查PropTypes时,遇到错误:TypeError: Cannot read property 'array' of undefined 看了下自己的React版本: ...
随机推荐
- Copying GC (Part one)
目录 GC复制算法 copy()函数 将传递给自己的参数复制,然后递归复制其孩子 new_obj()函数 执行过程 缺点 Cheney的GC复制算法 copy()函数 执行过程 被隐藏的队列 优缺点 ...
- IDEA下——Spring入门程序
创建一个Maven的项目,我的项目结构如下: 在pom文件里写下需要导入的依赖: <?xml version="1.0" encoding="UTF-8" ...
- 封装TensorFlow神经网络
为了参加今年的软件杯设计大赛,这几个月学习了很多新知识.现在大赛的第二轮作品优化已经提交,开始对这四个月所学知识做一些总结与记录. 用TensorFlow搭建神经网络.TensorFlow将神经网络的 ...
- Maven学习总结(19)——深入理解Maven相关配置
MAVEN2的配置文件有两个settings.xml和pom.xml settings.xml:保存的是本地所有项目所共享的全局配置信息,默认在maven安装目录的conf目录下,如果没有安装mave ...
- 用Understand阅读 VS2010项目源码
一.查看vs2010项目 打开understand,File-New-Project...-Next-Next [向导第三步,选"Import Visual Sudio project fi ...
- 什么是string interning(字符串驻留)以及python中字符串的intern机制
Incomputer science, string interning is a method of storing only onecopy of each distinct string val ...
- hdoj-1421-搬寝室【DP】
搬寝室 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submis ...
- adb-端口被占用解决办法(win)
今天在window下使用adb的时候,提示我说5037端口被占用. * daemon not running. starting it now on port * ADB server didn't ...
- react-native React Native version mismatch
android/app/build.gradle file: dependencies { compile fileTree(dir: "libs", include: [ ...
- Ueditor 七牛集成
UEDITOR修改成功的 http://blog.csdn.net/uikoo9/article/details/41844747 http://blog.csdn.net/u010717403/ar ...