├── .babelrc
├── .gitignore
├── angular
├── app.js
└── index.html
├── angular5
├── .gitignore
├── app
│ ├── app.component.ts
│ ├── app.module.ts
│ └── main.ts
├── index.html
├── package-lock.json
├── package.json
├── systemjs.config.js
└── tsconfig.json
├── bootstrap
├── app.js
├── bootstrap-theme.js
├── bootstrap.js
└── index.html
├── calendar
├── components
│ ├── calendar
│ │ ├── index.js
│ │ └── style.js
│ ├── canvas
│ │ ├── index.js
│ │ └── style.js
│ ├── conf
│ │ └── index.js
│ ├── event
│ │ ├── content-tpl.js
│ │ ├── index.js
│ │ └── style.js
│ ├── events-manager
│ │ ├── distribute.js
│ │ └── index.js
│ ├── jss.js
│ ├── timeline
│ │ ├── index.js
│ │ ├── marker-tpl.js
│ │ └── style.js
│ └── utils
│ │ └── index.js
├── dist
│ └── index.js
├── index.html
├── index.js
└── webpack.config.js
├── composition
├── app.js
├── component-a-style.js
├── component-b-style.js
└── index.html
├── dynamic-props
├── app.js
└── index.html
├── example.css
├── favicon.ico
├── function-values
├── Controls.js
├── app.js
├── dist
│ └── app.js
├── index.html
├── index.js
├── jssRenderer.js
├── reactInlineRenderer.js
├── reactJssRenderer.js
├── utils.js
└── webpack.config.js
├── index.html
├── inline
├── app.js
└── index.html
├── jss-camel-case.js
├── jss-debug.js
├── jss-default-unit.js
├── jss-extend.js
├── jss-global.js
├── jss-isolate.js
├── jss-nested.js
├── jss-preset-default.js
├── jss-props-sort.js
├── jss-vendor-prefixer.js
├── jss.js
├── observables
├── dist
│ ├── app.js
│ └── app.js.map
├── index.html
├── index.js
└── webpack.config.js
├── package-lock.json
├── package.json
├── perdido.js
├── perdido
├── app.js
├── index.html
└── styles.js
├── plugins
├── jss-camel-case
│ └── simple
│ │ ├── app.js
│ │ └── index.html
├── jss-default-unit
│ └── simple
│ │ ├── app.js
│ │ └── index.html
├── jss-extend
│ ├── multi
│ │ ├── app.js
│ │ └── index.html
│ └── simple
│ │ ├── app.js
│ │ └── index.html
├── jss-global
│ ├── app.js
│ └── index.html
├── jss-isolate
│ └── simple
│ │ ├── app.js
│ │ └── index.html
├── jss-nested
│ └── simple
│ │ ├── app.js
│ │ └── index.html
└── jss-props-sort
│ └── simple
│ ├── app.js
│ └── index.html
├── react-ssr
├── bin
│ └── build.js
├── dist
│ ├── app.js
│ └── index.html
├── src
│ ├── Button.js
│ ├── client.js
│ └── server.js
└── webpack.config.js
├── readme.md
├── swinging-cat-rx
├── README.md
├── dist
│ └── app.js
├── index.html
├── index.js
├── package-lock.json
├── package.json
├── src
│ ├── animation.js
│ ├── ear.js
│ ├── face.js
│ ├── globalStyles.js
│ ├── hand.js
│ ├── jss.js
│ ├── leg.js
│ ├── lowerBody.js
│ ├── scene.js
│ ├── tail.js
│ ├── theme.js
│ ├── upperBody.js
│ └── yarn.js
└── webpack.config.js
└── swinging-cat
├── README.md
├── dist
└── app.js
├── index.html
├── index.js
├── package.json
├── src
├── ear.js
├── face.js
├── globalStyles.js
├── hand.js
├── jss.js
├── keyframes.js
├── leg.js
├── lowerBody.js
├── scene.js
├── tail.js
├── theme.js
├── upperBody.js
└── yarn.js
└── webpack.config.js
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["es2015", "react", "stage-0"]
3 | }
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .DS_Store
3 | npm-debug.log
4 | tmp
5 | *~
6 |
--------------------------------------------------------------------------------
/angular/app.js:
--------------------------------------------------------------------------------
1 | // Styles
2 | var styles = {
3 | button1: {
4 | padding: '20px',
5 | background: 'blue',
6 | color: '#fff'
7 | },
8 | button2: {
9 | padding: '10px',
10 | background: 'red'
11 | }
12 | }
13 |
14 | // Application logic.
15 | var sheet = jss.default.createStyleSheet(styles).attach()
16 |
17 | angular
18 | .module('myApp', [])
19 | .controller('myController', function MyController($scope) {
20 | $scope.classes = sheet.classes
21 | $scope.showSource = function () {
22 | location.href = 'https://github.com/cssinjs/examples/tree/master/angular'
23 | }
24 | })
25 |
--------------------------------------------------------------------------------
/angular/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | `
42 | } else {
43 | leg = `
`
44 | }
45 | for (let t = 0; t <= 15; t++) {
46 | leg += `
`
47 | }
48 | leg += `
`
49 | for (let t = 0; t <= 15; t++) {
50 | leg += '
'
51 | }
52 | leg += '
'
53 | return leg
54 | }
55 |
--------------------------------------------------------------------------------
/swinging-cat-rx/src/lowerBody.js:
--------------------------------------------------------------------------------
1 | import jss from './jss'
2 | import * as theme from './theme'
3 | import leg from './leg'
4 | import tail from './tail'
5 | import { swingAnimation$ } from './animation'
6 |
7 | const styles = {
8 | catLowerWrap: {
9 | height: '90%',
10 | position: 'absolute',
11 | top: '100%',
12 | width: 75,
13 | left: 'calc(50% - 37.5px)',
14 | transformOrigin: 'top center',
15 | transform: swingAnimation$(-1).delay(100)
16 | },
17 | catLower: {
18 | position: 'absolute',
19 | top: 0,
20 | left: 0,
21 | width: '100%',
22 | height: '100%',
23 | transform: swingAnimation$(),
24 | transformOrigin: 'top center',
25 | '&:after': {
26 | content: '""',
27 | position: 'absolute',
28 | top: 0,
29 | left: 0,
30 | width: '100%',
31 | height: '100%',
32 | borderRadius: 100,
33 | backgroundImage: `radial-gradient(circle at 10px 50px, #ffffff, #ffffff 40%, ${theme.colorFurLight} 65%, ${theme.colorFurDark})`,
34 | zIndex: 1
35 | }
36 | }
37 | }
38 |
39 | const {classes} = jss.createStyleSheet(styles, {link: true}).attach()
40 |
41 | export default () => `
42 |
43 |
44 | ${leg(true)}
45 | ${leg(false)}
46 | ${tail()}
47 |
48 |
49 | `
50 |
--------------------------------------------------------------------------------
/swinging-cat-rx/src/scene.js:
--------------------------------------------------------------------------------
1 | import jss from './jss'
2 | import { Observable } from 'rxjs'
3 | import * as theme from './theme'
4 | import yarn from './yarn'
5 | import upperBody from './upperBody'
6 | import lowerBody from './lowerBody'
7 | import { swingAnimation$, doAnimation$, translateY, getPercentValue } from './animation'
8 |
9 | const animationValues = [
10 | { percent: 100, value: 0.4 },
11 | { percent: 93.75, value: -0.4 },
12 | { percent: 87.5, value: 0.4 },
13 | { percent: 81.25, value: -0.4 },
14 | { percent: 75, value: 0.4 },
15 | { percent: 68.75, value: -0.4 },
16 | { percent: 62.5, value: 0.4 },
17 | { percent: 56.25, value: -0.4 },
18 | { percent: 50, value: 0.4 },
19 | { percent: 43.75, value: -0.4 },
20 | { percent: 37.5, value: 0.4 },
21 | { percent: 31.25, value: -0.4 },
22 | { percent: 25, value: 0.4 },
23 | { percent: 18.75, value: -0.4 },
24 | { percent: 12.5, value: 0.4 },
25 | { percent: 6.25, value: -0.4 },
26 | { percent: 0, value: 0.4 }
27 | ]
28 |
29 | const styles = {
30 | root: {
31 | width: '100%',
32 | height: '100%',
33 | transitionTimingFunction: theme.easing,
34 | transition: '0.9s'
35 | },
36 | scene: {
37 | top: '10rem',
38 | left: 'calc(50% - 2.5rem)',
39 | position: 'absolute',
40 | width: '5rem',
41 | height: '5rem',
42 | transformOrigin: 'center -20rem',
43 | transitionTimingFunction: theme.easing,
44 | transform: swingAnimation$().delay(100),
45 | '&:before': {
46 | content: '""',
47 | height: '20rem',
48 | width: 2,
49 | backgroundColor: theme.colorYarn,
50 | left: 'calc(50% - 1px)',
51 | bottom: '20rem'
52 | }
53 | },
54 | catWrap: {
55 | position: 'absolute',
56 | top: 0,
57 | left: 'calc(50% - 45px)',
58 | width: 90,
59 | height: 130,
60 | transform: swingAnimation$(-1),
61 | transformOrigin: 'top center'
62 | },
63 | cat: {
64 | position: 'absolute',
65 | top: 0,
66 | left: 0,
67 | width: '100%',
68 | height: '100%',
69 | transform: swingAnimation$().delay(150),
70 | transformOrigin: 'top center'
71 | }
72 | }
73 | const {classes} = jss.createStyleSheet(styles, {link: true}).attach()
74 |
75 |
76 | export default () => {
77 | const root = document.createElement('div')
78 | root.className = classes.root
79 |
80 | root.innerHTML = `
81 |
82 | ${yarn()}
83 |
84 |
85 | ${upperBody()}
86 | ${lowerBody()}
87 |
88 |
89 |
90 | `
91 | return root
92 | }
93 |
--------------------------------------------------------------------------------
/swinging-cat-rx/src/tail.js:
--------------------------------------------------------------------------------
1 | import jss from './jss'
2 | import * as theme from './theme'
3 | import { swingAnimation$ } from './animation'
4 |
5 |
6 | const styles = {
7 | catTail: {
8 | position: 'absolute',
9 | height: 15,
10 | width: 10,
11 | transformOrigin: 'top center',
12 | zIndex: 0,
13 | transform: swingAnimation$(-.4),
14 | transitionTimingFunction: theme.easing,
15 | backgroundImage: `linear-gradient(
16 | to right,
17 | #fff,
18 | ${theme.colorFurLight},
19 | ${theme.colorFurDark}
20 | )`,
21 | borderBottomLeftRadius: 10,
22 | borderBottomRightRadius: 10
23 | },
24 | catTailNotFirst: {
25 | top: '50%'
26 | },
27 | catTailFirst: {
28 | left: 'calc(50% - 5px)',
29 | top: '95%'
30 | }
31 | }
32 |
33 | const {classes} = jss.createStyleSheet(styles, {link: true}).attach()
34 |
35 | export default () => {
36 | let tail = `
`
37 | for (let t = 0; t <= 15; t++) {
38 | tail += `
`
39 | }
40 | for (let t = 0; t <= 15; t++) {
41 | tail += '
'
42 | }
43 | tail += '
'
44 | return tail
45 | }
46 |
--------------------------------------------------------------------------------
/swinging-cat-rx/src/theme.js:
--------------------------------------------------------------------------------
1 | export const colorBg = '#1F1F3C'
2 | export const colorFurLight = '#D5E8F8'
3 | export const colorFurDark = '#8B9BD9'
4 | export const colorFeatures = '#4B4D75'
5 | export const colorFeaturesLight = '#9FA2CB'
6 | export const colorYarn = '#DB242A'
7 | export const easing = 'cubic-bezier(0.5, 0, 0.5, 1)'
8 | export const offset = '.5s'
9 | export const duration = 5
10 |
11 |
--------------------------------------------------------------------------------
/swinging-cat-rx/src/upperBody.js:
--------------------------------------------------------------------------------
1 | import jss from './jss'
2 | import * as theme from './theme'
3 | import face from './face'
4 | import hand from './hand'
5 | import ear from './ear'
6 |
7 | const styles = {
8 | catUpper: {
9 | position: 'absolute',
10 | top: 0,
11 | left: 0,
12 | width: '100%',
13 | height: '100%',
14 | transformOrigin: 'top center',
15 | zIndex: 1
16 | },
17 | catHead: {
18 | width: 90,
19 | height: 90,
20 | backgroundImage: `radial-gradient(
21 | circle at 10px 10px,
22 | #ffffff,
23 | #ffffff 40%,
24 | ${theme.colorFurLight} 65%,
25 | ${theme.colorFurDark}
26 | )`,
27 | borderRadius: '50%',
28 | top: 'calc(100% - 45px)'
29 | },
30 | catEars: {
31 | position: 'absolute',
32 | top: 0,
33 | left: 0,
34 | height: '50%',
35 | width: '100%',
36 | zIndex: -1
37 | }
38 | }
39 |
40 | const {classes} = jss.createStyleSheet(styles).attach()
41 |
42 | export default () => `
43 |
44 | ${hand()}
45 | ${hand()}
46 |
47 |
48 | ${ear()}
49 | ${ear()}
50 |
51 | ${face()}
52 |
53 |
54 | `
55 |
--------------------------------------------------------------------------------
/swinging-cat-rx/src/yarn.js:
--------------------------------------------------------------------------------
1 | import jss from './jss'
2 | import * as theme from './theme'
3 |
4 | const styles = {
5 | yarn: {
6 | position: 'absolute',
7 | top: 0,
8 | left: 0,
9 | width: 80,
10 | height: 80,
11 | borderRadius: '50%',
12 | backgroundImage: `radial-gradient(
13 | circle at top left,
14 | #e97c7f,
15 | ${theme.colorYarn} 50%,
16 | #af1d22
17 | )`,
18 | zIndex: 1,
19 | '&:before': {
20 | content: '""',
21 | left: 'calc(50% + 7px)',
22 | position: 'absolute',
23 | width: 20,
24 | height: 20,
25 | borderRadius: '50%',
26 | backgroundColor: '#fff',
27 | top: -1
28 | },
29 | '&:after': {
30 | content: '""',
31 | right: 'calc(50% + 7px)',
32 | position: 'absolute',
33 | width: 20,
34 | height: 20,
35 | borderRadius: '50%',
36 | backgroundColor: '#fff',
37 | top: -1
38 | }
39 | }
40 | }
41 |
42 | const {classes} = jss.createStyleSheet(styles).attach()
43 |
44 | export default () => `
`
45 |
--------------------------------------------------------------------------------
/swinging-cat-rx/webpack.config.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | var webpack = require('webpack')
4 | var path = require('path')
5 |
6 | module.exports = {
7 | entry: path.join(__dirname, 'index.js'),
8 | output: {
9 | path: path.join(__dirname, './dist'),
10 | filename: 'app.js'
11 | },
12 | module: {
13 | loaders: [
14 | {
15 | loader: 'babel-loader',
16 | test: /\.js$/,
17 | exclude: /node_modules/
18 | }
19 | ]
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/swinging-cat/README.md:
--------------------------------------------------------------------------------
1 | ## Build
2 |
3 | ```bash
4 | cd swinging-cat
5 | npm install
6 | cd ..
7 | npm run build:swinging-cat
8 | open swinging-cat/index.html
9 | ```
10 |
--------------------------------------------------------------------------------
/swinging-cat/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
Swinging cat
6 |
7 |
17 |
18 |
19 |
Originally created by David Khorshid
20 |
View on Github
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/swinging-cat/index.js:
--------------------------------------------------------------------------------
1 | import './src/globalStyles'
2 | import scene from './src/scene'
3 |
4 | document.body.appendChild(scene())
5 |
--------------------------------------------------------------------------------
/swinging-cat/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "webpackbin-project",
3 | "version": "1.0.0",
4 | "description": "Project boilerplate",
5 | "scripts": {
6 | "start": "webpack-dev-server --content-base build/ --port 3000"
7 | },
8 | "dependencies": {
9 | "jss": "9.0.0",
10 | "jss-preset-default": "4.0.0",
11 | "rxjs": "5.4.3"
12 | },
13 | "devDependencies": {
14 | "html-webpack-plugin": "2.22.0",
15 | "webpack-dev-server": "2.3.0",
16 | "webpack": "^2.2.0",
17 | "babel-core": "^6.23.1",
18 | "babel-loader": "^6.2.10",
19 | "babel-preset-es2015": "^6.22.0",
20 | "babel-preset-stage-0": "^6.5.0"
21 | },
22 | "author": "WebpackBin",
23 | "license": "ISC"
24 | }
--------------------------------------------------------------------------------
/swinging-cat/src/ear.js:
--------------------------------------------------------------------------------
1 | import jss from './jss'
2 |
3 | const styles = {
4 | catEar: {
5 | width: 20,
6 | height: '100%',
7 | position: 'absolute',
8 | borderRadius: 5,
9 | top: -10,
10 | '&:before': {
11 | content: '""',
12 | width: '60%',
13 | height: '100%',
14 | top: 10,
15 | position: 'absolute',
16 | backgroundColor: '#fff'
17 | },
18 | '&:first-child': {
19 | left: 0,
20 | transformOrigin: 'top left',
21 | transform: 'skewY(40deg)',
22 | backgroundColor: '#fff',
23 | '&:before': {
24 | content: '""',
25 | left: 0,
26 | borderTopRightRadius: '50%',
27 | borderBottomRightRadius: '50%',
28 | backgroundColor: '#D7EBFB'
29 | }
30 | },
31 | '&:last-child': {
32 | right: 0,
33 | transformOrigin: 'top right',
34 | transform: 'skewY(-40deg)',
35 | backgroundColor: '#d1e6f7',
36 | '&:before': {
37 | content: '""',
38 | right: 0,
39 | borderTopLeftRadius: '50%',
40 | borderBottomLeftRadius: '50%',
41 | backgroundColor: '#e0f0fc'
42 | }
43 | }
44 | }
45 | }
46 |
47 | const {classes} = jss.createStyleSheet(styles).attach()
48 |
49 | export default () => `
`
50 |
--------------------------------------------------------------------------------
/swinging-cat/src/face.js:
--------------------------------------------------------------------------------
1 | import jss from './jss'
2 | import * as theme from './theme'
3 |
4 | const styles = {
5 | catFace: {
6 | position: 'absolute',
7 | top: 0,
8 | left: 0,
9 | height: '100%',
10 | width: '100%',
11 | animation: `face ${theme.duration} ${theme.easing} infinite both`,
12 | transformStyle: 'preserve-3d',
13 | perspective: 100
14 | },
15 | catEyes: {
16 | position: 'absolute',
17 | top: '50%',
18 | width: '100%',
19 | height: 6,
20 | animation: `blink ${theme.duration} step-end infinite both`,
21 | '&:before': {
22 | content: '""',
23 | left: 20,
24 | position: 'absolute',
25 | height: 6,
26 | width: 6,
27 | borderRadius: '50%',
28 | backgroundColor: theme.colorFeatures
29 | },
30 | '&:after': {
31 | content: '""',
32 | right: 20,
33 | position: 'absolute',
34 | height: 6,
35 | width: 6,
36 | borderRadius: '50%',
37 | backgroundColor: theme.colorFeatures
38 | }
39 | },
40 | catMouth: {
41 | position: 'absolute',
42 | width: 12,
43 | height: 8,
44 | backgroundColor: theme.colorFeatures,
45 | top: '60%',
46 | left: 'calc(50% - 6px)',
47 | borderTopLeftRadius: '50% 30%',
48 | borderTopRightRadius: '50% 30%',
49 | borderBottomLeftRadius: '50% 70%',
50 | borderBottomRightRadius: '50% 70%',
51 | transform: 'translateZ(10px)',
52 | '&:before': {
53 | content: '""',
54 | borderLeftColor: 'transparent',
55 | right: 'calc(50% - 1px)',
56 | transformOrigin: 'top right',
57 | transform: 'rotate(10deg)',
58 | position: 'absolute',
59 | width: '90%',
60 | height: '100%',
61 | border: `2px solid ${theme.colorFeaturesLight}`,
62 | top: '80%',
63 | borderRadius: 100,
64 | borderTopColor: 'transparent',
65 | zIndex: -1
66 | },
67 | '&:after': {
68 | content: '""',
69 | borderRightColor: 'transparent',
70 | left: 'calc(50% - 1px)',
71 | transformOrigin: 'top left',
72 | transform: 'rotate(-10deg)',
73 | position: 'absolute',
74 | width: '90%',
75 | height: '100%',
76 | border: `2px solid ${theme.colorFeaturesLight}`,
77 | top: '80%',
78 | borderRadius: 100,
79 | borderTopColor: 'transparent',
80 | zIndex: -1
81 | }
82 | },
83 | catWhiskers: {
84 | width: '50%',
85 | height: 8,
86 | position: 'absolute',
87 | bottom: '25%',
88 | left: '25%',
89 | transformStyle: 'preserve-3d',
90 | perspective: 60,
91 | '&:before': {
92 | content: '""',
93 | right: '100%',
94 | transformOrigin: 'right center',
95 | transform: 'rotateY(70deg) rotateZ(-10deg)',
96 | position: 'absolute',
97 | height: '100%',
98 | width: '30%',
99 | border: `2px solid ${theme.colorFeaturesLight}`,
100 | borderLeft: 'none',
101 | borderRight: 'none'
102 | },
103 | '&:after': {
104 | content: '""',
105 | left: '100%',
106 | transformOrigin: 'left center',
107 | transform: 'rotateY(-70deg) rotateZ(10deg)',
108 | position: 'absolute',
109 | height: '100%',
110 | width: '30%',
111 | border: `2px solid ${theme.colorFeaturesLight}`,
112 | borderLeft: 'none',
113 | borderRight: 'none'
114 | }
115 | }
116 | }
117 |
118 | const {classes} = jss.createStyleSheet(styles).attach()
119 |
120 | export default () => `
121 |
126 | `
127 |
--------------------------------------------------------------------------------
/swinging-cat/src/globalStyles.js:
--------------------------------------------------------------------------------
1 | import jss from './jss'
2 | import * as theme from './theme'
3 | import keyframes from './keyframes'
4 |
5 | const styles = {
6 | '@global': {
7 | body: {
8 | height: '100%',
9 | width: '100%',
10 | margin: 0,
11 | padding: 0,
12 | backgroundColor: theme.colorBg,
13 | overflow: 'hidden'
14 | },
15 | html: {
16 | height: '100%',
17 | width: '100%',
18 | margin: 0,
19 | padding: 0,
20 | backgroundColor: theme.colorBg,
21 | overflow: 'hidden'
22 | },
23 | '*': {
24 | boxSizing: 'border-box',
25 | position: 'relative',
26 | animationTimingFunction: theme.easing,
27 | animationFillMode: 'both',
28 | '&:before': {
29 | content: '""',
30 | display: 'block',
31 | boxSizing: 'border-box',
32 | position: 'relative',
33 | animationTimingFunction: theme.easing,
34 | animationFillMode: 'both'
35 | },
36 | '&:after': {
37 | content: '""',
38 | display: 'block',
39 | boxSizing: 'border-box',
40 | position: 'relative',
41 | animationTimingFunction: theme.easing,
42 | animationFillMode: 'both'
43 | }
44 | }
45 | },
46 | '@keyframes bob': keyframes.bob,
47 | '@keyframes reverse-swing': keyframes.reverseSwing,
48 | '@keyframes face': keyframes.face,
49 | '@keyframes blink': keyframes.blink,
50 | '@keyframes swing-leg': keyframes.swingLeg,
51 | '@keyframes swing-tail': keyframes.swingTail,
52 | '@keyframes swing': keyframes.swing
53 | }
54 |
55 | jss.createStyleSheet(styles).attach()
56 |
--------------------------------------------------------------------------------
/swinging-cat/src/hand.js:
--------------------------------------------------------------------------------
1 | import jss from './jss'
2 | import * as theme from './theme'
3 |
4 | const styles = {
5 | catHand: {
6 | position: 'absolute',
7 | width: 20,
8 | height: '100%',
9 | backgroundColor: '#fff',
10 | zIndex: -1,
11 | backgroundImage: `linear-gradient(to right, ${theme.colorFurLight}, ${theme.colorFurLight} 20%, ${theme.colorFurDark})`,
12 | '&:nth-child(1)': {
13 | borderTopLeftRadius: 100,
14 | left: 10,
15 | '&:after': {
16 | content: '""',
17 | left: '50%'
18 | }
19 | },
20 | '&:nth-child(2)': {
21 | borderTopLeftRadius: 0,
22 | borderTopRightRadius: 100,
23 | right: 10,
24 | '&:after': {
25 | content: '""',
26 | right: '50%'
27 | }
28 | }
29 | }
30 | }
31 |
32 | const {classes} = jss.createStyleSheet(styles).attach()
33 |
34 | export default () => `
`
35 |
--------------------------------------------------------------------------------
/swinging-cat/src/jss.js:
--------------------------------------------------------------------------------
1 | import jss from 'jss'
2 | import preset from 'jss-preset-default'
3 |
4 | export default jss.setup(preset())
5 |
--------------------------------------------------------------------------------
/swinging-cat/src/keyframes.js:
--------------------------------------------------------------------------------
1 | export default {
2 | bob: {
3 | '0%': {
4 | transform: 'translateY(0.4rem)'
5 | },
6 | '6.25%': {
7 | transform: 'translateY(-0.4rem)'
8 | },
9 | '12.5%': {
10 | transform: 'translateY(0.4rem)'
11 | },
12 | '18.75%': {
13 | transform: 'translateY(-0.4rem)'
14 | },
15 | '25%': {
16 | transform: 'translateY(0.4rem)'
17 | },
18 | '31.25%': {
19 | transform: 'translateY(-0.4rem)'
20 | },
21 | '37.5%': {
22 | transform: 'translateY(0.4rem)'
23 | },
24 | '43.75%': {
25 | transform: 'translateY(-0.4rem)'
26 | },
27 | '50%': {
28 | transform: 'translateY(0.4rem)'
29 | },
30 | '56.25%': {
31 | transform: 'translateY(-0.4rem)'
32 | },
33 | '62.5%': {
34 | transform: 'translateY(0.4rem)'
35 | },
36 | '68.75%': {
37 | transform: 'translateY(-0.4rem)'
38 | },
39 | '75%': {
40 | transform: 'translateY(0.4rem)'
41 | },
42 | '81.25%': {
43 | transform: 'translateY(-0.4rem)'
44 | },
45 | '87.5%': {
46 | transform: 'translateY(0.4rem)'
47 | },
48 | '93.75%': {
49 | transform: 'translateY(-0.4rem)'
50 | },
51 | '100%': {
52 | transform: 'translateY(0.4rem)'
53 | }
54 | },
55 | reverseSwing: {
56 | '0%': {
57 | transform: 'rotate(-5deg)'
58 | },
59 | '12.5%': {
60 | transform: 'rotate(10deg)'
61 | },
62 | '25%': {
63 | transform: 'rotate(-10deg)'
64 | },
65 | '37.5%': {
66 | transform: 'rotate(15deg)'
67 | },
68 | '50%': {
69 | transform: 'rotate(-23deg)'
70 | },
71 | '62.5%': {
72 | transform: 'rotate(23deg)'
73 | },
74 | '75%': {
75 | transform: 'rotate(-15deg)'
76 | },
77 | '87.5%': {
78 | transform: 'rotate(10deg)'
79 | },
80 | '100%': {
81 | transform: 'rotate(-5deg)'
82 | }
83 | },
84 | face: {
85 | '0%': {
86 | transform: 'translateX(-2.5px)'
87 | },
88 | '12.5%': {
89 | transform: 'translateX(5px)'
90 | },
91 | '25%': {
92 | transform: 'translateX(-5px)'
93 | },
94 | '37.5%': {
95 | transform: 'translateX(7.5px)'
96 | },
97 | '50%': {
98 | transform: 'translateX(-11.5px)'
99 | },
100 | '62.5%': {
101 | transform: 'translateX(11.5px)'
102 | },
103 | '75%': {
104 | transform: 'translateX(-7.5px)'
105 | },
106 | '87.5%': {
107 | transform: 'translateX(5px)'
108 | },
109 | '100%': {
110 | transform: 'translateX(-2.5px)'
111 | }
112 | },
113 | blink: {
114 | 'from, to, 10%, 25%, 80%': {
115 | transform: 'scaleY(1)'
116 | },
117 | '8%, 23%, 78%': {
118 | transform: 'scaleY(0.1)'
119 | }
120 | },
121 | swingLeg: {
122 | '0%': {
123 | transform: 'rotate(0.5deg)'
124 | },
125 | '12.5%': {
126 | transform: 'rotate(-1deg)'
127 | },
128 | '25%': {
129 | transform: 'rotate(1deg)'
130 | },
131 | '37.5%': {
132 | transform: 'rotate(-1.5deg)'
133 | },
134 | '50%': {
135 | transform: 'rotate(2.3deg)'
136 | },
137 | '62.5%': {
138 | transform: 'rotate(-2.3deg)'
139 | },
140 | '75%': {
141 | transform: 'rotate(1.5deg)'
142 | },
143 | '87.5%': {
144 | transform: 'rotate(-1deg)'
145 | },
146 | '100%': {
147 | transform: 'rotate(0.5deg)'
148 | }
149 | },
150 | swingTail: {
151 | '0%': {
152 | transform: 'rotate(-2deg)'
153 | },
154 | '12.5%': {
155 | transform: 'rotate(4deg)'
156 | },
157 | '25%': {
158 | transform: 'rotate(-4deg)'
159 | },
160 | '37.5%': {
161 | transform: 'rotate(6deg)'
162 | },
163 | '50%': {
164 | transform: 'rotate(-9.2deg)'
165 | },
166 | '62.5%': {
167 | transform: 'rotate(9.2deg)'
168 | },
169 | '75%': {
170 | transform: 'rotate(-6deg)'
171 | },
172 | '87.5%': {
173 | transform: 'rotate(4deg)'
174 | },
175 | '100%': {
176 | transform: 'rotate(-2deg)'
177 | }
178 | },
179 | swing: {
180 | '0%': {
181 | transform: 'rotate(5deg)'
182 | },
183 | '12.5%': {
184 | transform: 'rotate(-10deg)'
185 | },
186 | '25%': {
187 | transform: 'rotate(10deg)'
188 | },
189 | '37.5%': {
190 | transform: 'rotate(-15deg)'
191 | },
192 | '50%': {
193 | transform: 'rotate(23deg)'
194 | },
195 | '62.5%': {
196 | transform: 'rotate(-23deg)'
197 | },
198 | '75%': {
199 | transform: 'rotate(15deg)'
200 | },
201 | '87.5%': {
202 | transform: 'rotate(-10deg)'
203 | },
204 | '100%': {
205 | transform: 'rotate(5deg)'
206 | }
207 | }
208 | }
209 |
--------------------------------------------------------------------------------
/swinging-cat/src/leg.js:
--------------------------------------------------------------------------------
1 | import jss from './jss'
2 | import * as theme from './theme'
3 |
4 | const styles = {
5 | catLowerLegPaw: {
6 | position: 'absolute',
7 | height: 20,
8 | width: 20,
9 | animation: `swing-leg ${theme.duration} 0.3s infinite both`,
10 | zIndex: 1,
11 | transformOrigin: 'top center',
12 | borderTopLeftRadius: 20,
13 | borderTopRightRadius: 20,
14 | backgroundImage: `linear-gradient(to right, #fff, ${theme.colorFurLight}, ${theme.colorFurDark})`
15 | },
16 | catLegFirstNested: {
17 | bottom: 20
18 | },
19 | catLegNested: {
20 | top: '25%'
21 | },
22 | catLegSecond: {
23 | right: 0
24 | },
25 | catLowerPaw: {
26 | top: '50%',
27 | borderRadius: '50%',
28 | backgroundColor: '#fff'
29 | }
30 | }
31 |
32 | const {classes} = jss.createStyleSheet(styles).attach()
33 |
34 | export default (isFirstLeg) => {
35 | let leg = ''
36 | if (isFirstLeg) {
37 | leg = `
`
38 | } else {
39 | leg = `
`
40 | }
41 | for (let t = 0; t <= 15; t++) {
42 | leg += `
`
43 | }
44 | leg += `
`
45 | for (let t = 0; t <= 15; t++) {
46 | leg += '
'
47 | }
48 | leg += '
'
49 | return leg
50 | }
51 |
--------------------------------------------------------------------------------
/swinging-cat/src/lowerBody.js:
--------------------------------------------------------------------------------
1 | import jss from './jss'
2 | import * as theme from './theme'
3 | import leg from './leg'
4 | import tail from './tail'
5 |
6 | const styles = {
7 | catLowerWrap: {
8 | height: '90%',
9 | position: 'absolute',
10 | top: '100%',
11 | width: 75,
12 | left: 'calc(50% - 37.5px)',
13 | animation: `reverse-swing ${theme.duration} 0.2s infinite both`,
14 | transformOrigin: 'top center'
15 | },
16 | catLower: {
17 | position: 'absolute',
18 | top: 0,
19 | left: 0,
20 | width: '100%',
21 | height: '100%',
22 | animation: `swing ${theme.duration} ${theme.offset} infinite both`,
23 | transformOrigin: 'top center',
24 | '&:after': {
25 | content: '""',
26 | position: 'absolute',
27 | top: 0,
28 | left: 0,
29 | width: '100%',
30 | height: '100%',
31 | borderRadius: 100,
32 | backgroundImage: `radial-gradient(circle at 10px 50px, #ffffff, #ffffff 40%, ${theme.colorFurLight} 65%, ${theme.colorFurDark})`,
33 | zIndex: 1
34 | }
35 | }
36 | }
37 |
38 | const {classes} = jss.createStyleSheet(styles).attach()
39 |
40 | export default () => `
41 |
42 |
43 | ${leg(true)}
44 | ${leg(false)}
45 | ${tail()}
46 |
47 |
48 | `
49 |
--------------------------------------------------------------------------------
/swinging-cat/src/scene.js:
--------------------------------------------------------------------------------
1 | import jss from './jss'
2 | import * as theme from './theme'
3 | import yarn from './yarn'
4 | import upperBody from './upperBody'
5 | import lowerBody from './lowerBody'
6 |
7 | const styles = {
8 | root: {
9 | width: '100%',
10 | height: '100%',
11 | animation: `bob ${theme.duration} ${theme.easing} infinite both`
12 | },
13 | scene: {
14 | top: '10rem',
15 | left: 'calc(50% - 2.5rem)',
16 | position: 'absolute',
17 | width: '5rem',
18 | height: '5rem',
19 | transformOrigin: 'center -20rem',
20 | animation: `swing ${theme.duration} ${theme.easing} infinite both`,
21 | '&:before': {
22 | content: '""',
23 | height: '20rem',
24 | width: 2,
25 | backgroundColor: theme.colorYarn,
26 | left: 'calc(50% - 1px)',
27 | bottom: '20rem'
28 | }
29 | },
30 | catWrap: {
31 | position: 'absolute',
32 | top: 0,
33 | left: 'calc(50% - 45px)',
34 | width: 90,
35 | height: 130,
36 | animation: `reverse-swing ${theme.duration} ${theme.easing} infinite both`,
37 | transformOrigin: 'top center'
38 | },
39 | cat: {
40 | position: 'absolute',
41 | top: 0,
42 | left: 0,
43 | width: '100%',
44 | height: '100%',
45 | animation: `swing ${theme.duration} .2s infinite both`,
46 | transformOrigin: 'top center'
47 | }
48 | }
49 | const {classes} = jss.createStyleSheet(styles).attach()
50 |
51 |
52 | export default () => {
53 | const root = document.createElement('div')
54 | root.className = classes.root
55 |
56 | root.innerHTML = `
57 |
58 | ${yarn()}
59 |
60 |
61 | ${upperBody()}
62 | ${lowerBody()}
63 |
64 |
65 |
66 | `
67 | return root
68 | }
69 |
--------------------------------------------------------------------------------
/swinging-cat/src/tail.js:
--------------------------------------------------------------------------------
1 | import jss from './jss'
2 | import * as theme from './theme'
3 |
4 | const styles = {
5 | catTail: {
6 | position: 'absolute',
7 | height: 15,
8 | width: 10,
9 | animation: `swing-tail ${theme.duration} ${theme.easing} infinite both`,
10 | transformOrigin: 'top center',
11 | zIndex: 0,
12 | backgroundImage: `linear-gradient(to right, #fff, ${theme.colorFurLight}, ${theme.colorFurDark})`,
13 | borderBottomLeftRadius: 10,
14 | borderBottomRightRadius: 10
15 | },
16 | catTailNotFirst: {
17 | top: '50%'
18 | },
19 | catTailFirst: {
20 | left: 'calc(50% - 5px)',
21 | top: '95%'
22 | }
23 | }
24 |
25 | const {classes} = jss.createStyleSheet(styles).attach()
26 |
27 | export default () => {
28 | let tail = `
`
29 | for (let t = 0; t <= 15; t++) {
30 | tail += `
`
31 | }
32 | for (let t = 0; t <= 15; t++) {
33 | tail += '
'
34 | }
35 | tail += '
'
36 | return tail
37 | }
38 |
--------------------------------------------------------------------------------
/swinging-cat/src/theme.js:
--------------------------------------------------------------------------------
1 | export const colorBg = '#1F1F3C'
2 | export const colorFurLight = '#D5E8F8'
3 | export const colorFurDark = '#8B9BD9'
4 | export const colorFeatures = '#4B4D75'
5 | export const colorFeaturesLight = '#9FA2CB'
6 | export const colorYarn = '#DB242A'
7 | export const duration = '7s'
8 | export const easing = 'cubic-bezier(0.5, 0, 0.5, 1)'
9 | export const offset = '.5s'
10 | export const swings = '5 -10 10 -15 23 -23 15 -10 5'
11 | export const totalSwings = 'length($swings)'
12 |
--------------------------------------------------------------------------------
/swinging-cat/src/upperBody.js:
--------------------------------------------------------------------------------
1 | import jss from './jss'
2 | import * as theme from './theme'
3 | import face from './face'
4 | import hand from './hand'
5 | import ear from './ear'
6 |
7 | const styles = {
8 | catUpper: {
9 | position: 'absolute',
10 | top: 0,
11 | left: 0,
12 | width: '100%',
13 | height: '100%',
14 | transformOrigin: 'top center',
15 | zIndex: 1
16 | },
17 | catHead: {
18 | width: 90,
19 | height: 90,
20 | backgroundImage: `radial-gradient(circle at 10px 10px, #ffffff, #ffffff 40%, ${theme.colorFurLight} 65%, ${theme.colorFurDark})`,
21 | borderRadius: '50%',
22 | top: 'calc(100% - 45px)'
23 | },
24 | catEars: {
25 | position: 'absolute',
26 | top: 0,
27 | left: 0,
28 | height: '50%',
29 | width: '100%',
30 | zIndex: -1
31 | }
32 | }
33 |
34 | const {classes} = jss.createStyleSheet(styles).attach()
35 |
36 | export default () => `
37 |
38 | ${hand()}
39 | ${hand()}
40 |
41 |
42 | ${ear()}
43 | ${ear()}
44 |
45 | ${face()}
46 |
47 |
48 | `
49 |
--------------------------------------------------------------------------------
/swinging-cat/src/yarn.js:
--------------------------------------------------------------------------------
1 | import jss from './jss'
2 | import * as theme from './theme'
3 |
4 | const styles = {
5 | yarn: {
6 | position: 'absolute',
7 | top: 0,
8 | left: 0,
9 | width: 80,
10 | height: 80,
11 | borderRadius: '50%',
12 | backgroundImage: `radial-gradient(circle at top left, #e97c7f, ${theme.colorYarn} 50%, #af1d22)`,
13 | zIndex: 1,
14 | '&:before': {
15 | content: '""',
16 | left: 'calc(50% + 7px)',
17 | position: 'absolute',
18 | width: 20,
19 | height: 20,
20 | borderRadius: '50%',
21 | backgroundColor: '#fff',
22 | top: -1
23 | },
24 | '&:after': {
25 | content: '""',
26 | right: 'calc(50% + 7px)',
27 | position: 'absolute',
28 | width: 20,
29 | height: 20,
30 | borderRadius: '50%',
31 | backgroundColor: '#fff',
32 | top: -1
33 | }
34 | }
35 | }
36 |
37 | const {classes} = jss.createStyleSheet(styles).attach()
38 |
39 | export default () => `
`
40 |
--------------------------------------------------------------------------------
/swinging-cat/webpack.config.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | var webpack = require('webpack')
4 | var path = require('path')
5 |
6 | module.exports = {
7 | entry: path.join(__dirname, 'index.js'),
8 | output: {
9 | path: path.join(__dirname, './dist'),
10 | filename: 'app.js'
11 | },
12 | module: {
13 | loaders: [
14 | {
15 | loader: 'babel-loader',
16 | test: /\.js$/,
17 | exclude: /node_modules/
18 | }
19 | ]
20 | }
21 | }
22 |
--------------------------------------------------------------------------------