“The only way to get rid of a temptation is to yield to it. 49 | Resist it, and your soul grows sick with longing for the things it has forbidden to itself, with desire for what its monstrous laws have made monstrous and unlawful.” 50 | 51 |52 |
├── christmas ├── .gitignore ├── .sass-cache │ └── 15d8c244cf2d78c268141cba1aea96bb05465346 │ │ └── index.scssc ├── package.json ├── gulpfile.js ├── index.html ├── index.scss └── dist │ └── css │ └── index.css ├── README.md ├── text ├── timg.jpg └── clip-text.html ├── center ├── one.jpg ├── 居中.html ├── flex.html └── README.md ├── cssShape ├── static │ ├── images │ │ ├── exp.jpg │ │ ├── logo.jpg │ │ ├── logo.png │ │ └── forkme.png │ └── css │ │ ├── reset.css │ │ └── index.css ├── README.md └── html │ └── index.html ├── interestingNote └── 条状背景 │ ├── img │ ├── forkme.png │ ├── graphic1.jpg │ ├── graphic2.jpg │ ├── graphic3.jpg │ ├── graphic4.jpg │ └── graphic5.jpg │ ├── test │ ├── index.css │ ├── reset.css │ └── test.html │ └── README.md ├── layout ├── README.md └── adaption │ ├── margin.html │ ├── flex.html │ ├── table-cell.html │ ├── 多列等高布局 │ ├── table-cell.html │ ├── margin-padding.html │ └── flex.html │ ├── 3列 │ ├── flex.html │ ├── table-cell.html │ └── float -margin.html │ └── float -margin.html ├── hexagon-grid-w-hover ├── README.txt ├── license.txt ├── scss │ └── style.scss ├── css │ └── style.css └── index.html ├── minion ├── style │ └── index.css ├── minion.html └── js │ └── minion.js ├── frost_glass ├── README.md └── frost_glass.html ├── hiddenface ├── rain.scss ├── index.html ├── rain.css.map ├── rain.css └── index.js ├── macbook ├── index.html └── css │ └── index.css └── heart └── index.html /christmas/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CSS-note 2 | CSS笔记 3 | -------------------------------------------------------------------------------- /text/timg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FounderIsShadowWalker/CSS-note/HEAD/text/timg.jpg -------------------------------------------------------------------------------- /center/one.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FounderIsShadowWalker/CSS-note/HEAD/center/one.jpg -------------------------------------------------------------------------------- /cssShape/static/images/exp.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FounderIsShadowWalker/CSS-note/HEAD/cssShape/static/images/exp.jpg -------------------------------------------------------------------------------- /cssShape/static/images/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FounderIsShadowWalker/CSS-note/HEAD/cssShape/static/images/logo.jpg -------------------------------------------------------------------------------- /cssShape/static/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FounderIsShadowWalker/CSS-note/HEAD/cssShape/static/images/logo.png -------------------------------------------------------------------------------- /cssShape/static/images/forkme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FounderIsShadowWalker/CSS-note/HEAD/cssShape/static/images/forkme.png -------------------------------------------------------------------------------- /interestingNote/条状背景/img/forkme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FounderIsShadowWalker/CSS-note/HEAD/interestingNote/条状背景/img/forkme.png -------------------------------------------------------------------------------- /interestingNote/条状背景/img/graphic1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FounderIsShadowWalker/CSS-note/HEAD/interestingNote/条状背景/img/graphic1.jpg -------------------------------------------------------------------------------- /interestingNote/条状背景/img/graphic2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FounderIsShadowWalker/CSS-note/HEAD/interestingNote/条状背景/img/graphic2.jpg -------------------------------------------------------------------------------- /interestingNote/条状背景/img/graphic3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FounderIsShadowWalker/CSS-note/HEAD/interestingNote/条状背景/img/graphic3.jpg -------------------------------------------------------------------------------- /interestingNote/条状背景/img/graphic4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FounderIsShadowWalker/CSS-note/HEAD/interestingNote/条状背景/img/graphic4.jpg -------------------------------------------------------------------------------- /interestingNote/条状背景/img/graphic5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FounderIsShadowWalker/CSS-note/HEAD/interestingNote/条状背景/img/graphic5.jpg -------------------------------------------------------------------------------- /layout/README.md: -------------------------------------------------------------------------------- 1 | 几列定宽 几列自适应的布局 2 | 1. margin + float 3 | 2. table-cell(自适应的with 3000 撑开) 4 | 3. float -margin 多列全float 利用-margin 定位置 5 | 4. flex 布局 6 | 5. calc -------------------------------------------------------------------------------- /cssShape/README.md: -------------------------------------------------------------------------------- 1 | ##致敬css secret 2 | ##和Coco的demo 3 | >作者 https://github.com/chokcoco 4 | 5 | 有任意一个 demo 无法理解的,可以随时提issue 6 | 7 | >演示地址http://www.singlefounder.cn/cssShape/html -------------------------------------------------------------------------------- /hexagon-grid-w-hover/README.txt: -------------------------------------------------------------------------------- 1 | A Pen created at CodePen.io. You can find this one at https://codepen.io/johnheiner/pen/EKpQeP. 2 | 3 | CSS Hexagon grid with animation flip on hover -------------------------------------------------------------------------------- /christmas/.sass-cache/15d8c244cf2d78c268141cba1aea96bb05465346/index.scssc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FounderIsShadowWalker/CSS-note/HEAD/christmas/.sass-cache/15d8c244cf2d78c268141cba1aea96bb05465346/index.scssc -------------------------------------------------------------------------------- /minion/style/index.css: -------------------------------------------------------------------------------- 1 | html,body { 2 | width: 100%; 3 | height: 100%; 4 | margin: 0; 5 | padding: 0; 6 | overflow: hidden; 7 | } 8 | 9 | div{ 10 | position: relative; 11 | width: 100%; 12 | height: 100%; 13 | overflow: hidden; 14 | display: flex; 15 | justify-content: center; 16 | align-items: center; 17 | } -------------------------------------------------------------------------------- /christmas/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "christ", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "gulp": "^3.9.1", 13 | "gulp-ruby-sass": "^2.1.1" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /minion/minion.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |left
31 |right
34 |right
35 |right
36 |left
33 |right
36 |right
37 |right
38 |right
39 |left
39 |right
42 |right
43 |right
44 |left
47 |right
50 |right
51 |right
52 |left
55 |right
58 |right
59 |right
60 |“The only way to get rid of a temptation is to yield to it. 49 | Resist it, and your soul grows sick with longing for the things it has forbidden to itself, with desire for what its monstrous laws have made monstrous and unlawful.” 50 | 51 |52 |
14 | div.outer{
15 | position: relative;
16 | background: red;
17 | width: 200px;
18 | height: 200px;
19 | overflow: hidden;
20 | }
21 | div.outer > div.inner{
22 | position: relative;
23 | background: #0000f6;
24 | width: 100px;
25 | height: 100px;
26 | top: 50%;
27 | left: 50%;
28 | margin: -50px 0 0 -50px;
29 | }
30 |
31 |
32 | 2.子级 postion: static 的居中方法。
33 |
34 |
35 | div.outer{
36 | position: relative;
37 | background: red;
38 | width: 200px;
39 | height: 200px;
40 | overflow: hidden;
41 | }
42 | div.outer > div.inner{
43 | background: #0000f6;
44 | width: 100px;
45 | height: 100px;
46 | margin: 50px auto 0 auto;
47 | }
48 |
49 |
50 | 3.子级absolute 的居中方法设置top left margin 等同于父级relative 与 子级relative的 方案。
51 |
52 |
53 | ##父级position 为absolute 情况
54 | 1.子级position: relative和absolute的情况
55 |
56 | 设置top left margin 等同于父级relative 与 子级relative的 方案。
57 | 2.子级 static: 等同于 父级 relative 与 子级 static 的方案
58 |
59 | ## 父级postion 为static 情况
60 | 这里给一些知识点
61 |
62 | 1. top 和 left 百分比是相对于 height 和 width的, absolute 是相对于离它最近的 absolute 父类 的 height 和 width,relative 是相对于 父类。
63 |
64 |
65 | ***
66 | 华丽的分割线
67 |
68 | 上面的布局其实实际运用非常有限,我们很少会写死每个元素的宽高。大部分都是百分比布局。
69 |
70 | 百分比布局最大的问题,就是我们不知道具体的宽高,所以margin无法设置准确值。
71 |
72 | ##父级relative 宽高固定 子级宽高百分比
73 | 1. 子级relative 和 absolute的情况
74 |
75 |
76 | div.outer{
77 | position: static;
78 | top: 0;
79 | left: 0;
80 | background: red;
81 | width: 500px;
82 | height: 200px;
83 | overflow: hidden;
84 | }
85 | div.outer > div.inner{
86 | position: relative;
87 | background: #0000f6;
88 | width: 50%;
89 | height: 50%;
90 | top: 50%;
91 | left: 50%;
92 | transform: translateX(-50%) translateY(-50%);
93 | }
94 |
95 |
96 | 上面的方法作用于 定位元素 包治百病 除了ie8 及以下 不支持css3 的浏览器。
97 |
98 | 2.子级static
99 |
100 | 无能为力
101 |
102 |
103 | 一些非主流的居中方案 table-cell 居中
104 |
105 | table-cell 对应于 table 中的 td 对于 td 我们自然可以使用verical-align 来实现垂直居中, 水平居中在内层使用margin: 0 auto。
106 |
107 |
108 | div.outer{
109 | position: static;
110 | top: 0;
111 | left: 0;
112 | background: red;
113 | width: 500px;
114 | height: 200px;
115 | overflow: hidden;
116 | display: table;
117 | }
118 | div.outer > div.inner{
119 | position: relative;
120 | background: #0000f6;
121 | width: 100%;
122 | height: 100%;
123 | display: table-cell;
124 | vertical-align: middle;
125 | }
126 | div.inner > div.target{
127 | width: 100px;
128 | height: 100px;
129 | background: #FFFFFF;
130 | margin: 0 auto;
131 | }
132 |
133 |
134 | 显然这样的居中有好有坏,好处自然是没有 ie8 的坎, 但是却多出来了一个标签,先前仿 Tumblr 的时候,发现里面的前端喜欢这样,至于好坏大家拿捏吧。
135 |
136 | 最后有一种懒人居中法,适应于你不想使用以上两种方法,然后想取巧的话,当然适用方法只适用于内标签为absolute 情况.
137 |
138 |
139 | div.outer{
140 | position: absolute;
141 | top: 0;
142 | left: 0;
143 | background: red;
144 | width: 500px;
145 | height: 200px;
146 | overflow: hidden;
147 | display: table;
148 | }
149 | div.outer > div.inner{
150 | position: absolute;
151 | background: #0000f6;
152 | width: 50%;
153 | height: 50%;
154 | top: 0;
155 | left: 0;
156 | bottom: 0;
157 | right: 0;
158 | margin: auto;
159 | }
160 |
161 | 在仿十年后的网站时,看到每张全屏轮播的时候,里面的居中页就是采用这样的方法,当然他的局限性太小了,只能 absolute + absolute. 或者 absolute 全页居中,大家在写页面的时候,可以自己取舍,毕竟这个没有ie6 ie8 的坎。
162 |
163 |
164 |
165 | ##flex 布局
166 |
167 | 2009 年 w3c 提出来的,现在已经得到了所有浏览器的支持,我们看一下flex的 API.
168 |
169 | >转一篇阮一峰老师的 flex 使用很详细 http://www.ruanyifeng.com/blog/2015/07/flex-examples.html
170 |
171 | 设置在 主轴(横轴) 的对其方式 作用于父类容器上
172 | justify-content: flex-start | flex-end | center | space-between | space-around
173 |
174 | 设置在 侧轴(纵轴)的 对其方式 作用于父类容器上
175 | align-items: flex-start | flex-end | center | baseline | stretch
176 |
177 | flex-direction: row | column
178 | 设置flex 布局的主轴
179 |
180 | flex-wrap: nowrap | wrap | wrap-reverse
181 | 设置 flex 单行 或 多行
182 |
183 |
184 | 一个水平 垂直居中的例子就很好实现了
185 |
186 | div.box{
187 | width: 200px;
188 | height: 200px;
189 | background: #0000f6;
190 | display: flex;
191 | justify-content: center;
192 | align-items: center;
193 | }
194 | div.box > div.item{
195 | width: 100px;
196 | height: 100px;
197 | background: red;
198 | }
199 |
200 |
201 | 多个子div的实现也很简单
202 | 这里 提一下 flex-direction 默认为 row 也就是横轴为主轴,改成 column 后,align-item 与justify-content 就交换了。
203 |
204 |
205 | div.box{
206 | width: 200px;
207 | height: 200px;
208 | background: #0000f6;
209 | display: flex;
210 | flex-direction: column; /*设置主轴*/
211 | justify-content: space-around; /* 设置在 主轴(横轴) 的对其方式 */
212 | align-items: center; /* 设置在 侧轴(纵轴)的 对其方式 */
213 | }
214 | div.box > div.item{
215 | width: 50px;
216 | height: 50px;
217 | background: red;
218 |
219 | }
220 |
221 |
222 | ##inline-block 在 block的居中
223 | 1. table-cell 和 inline-block 相仿,我们看到td 并不存在换行的现象
224 | 2. 我们以一般的角度来看看如何实现
225 |
226 | 首先需要一个basic 高100% 来作为基准,然后设置vertical-aligin: middle 来对齐basic的中部
227 |
228 |
229 | div.outer{
230 | position: relative;
231 | top: 0;
232 | left: 0;
233 | background: red;
234 | width: 500px;
235 | height: 500px;
236 | overflow: hidden;
237 | /*text-align: center;*/
238 | }
239 | div.outer > div.inner{
240 | width: 100px;
241 | height: 100px;
242 | background: #0000f6;
243 | display: inline-block;
244 | vertical-align: middle;
245 | }
246 | div.outer > div.basic{
247 | top:0;
248 | left: 0;
249 | position: relative;
250 | width: 0px;
251 | height: 100%;
252 | background: green;
253 | vertical-align: middle;
254 | display: inline-block;
255 | }
256 |
257 |
258 |
259 | 最后一个inline 居中了 主要应用 line-height 上下间距加起来等于父类的高度 就能实现居中了
260 |
261 |
262 | div.outer{
263 | position: relative;
264 | top: 0;
265 | left: 0;
266 | background: red;
267 | width: 500px;
268 | height: 500px;
269 | overflow: hidden;
270 | text-align: center;
271 | }
272 | span{
273 | line-height: 500px;
274 | }
275 |
276 | 当然把inline 变成 inline-block 居中自然也是可以的,也比较推崇这种,因为往往父类的高度是不固定的,需要做出自适应,第一种方案就能完美解决了。
277 |
278 |
279 | 居中的方案大致就这些了,大家晚安。
--------------------------------------------------------------------------------
/christmas/dist/css/index.css:
--------------------------------------------------------------------------------
1 | @charset "UTF-8";
2 | body, html {
3 | margin: 0;
4 | padding: 0;
5 | width: 100%;
6 | height: 100%;
7 | overflow: hidden; }
8 |
9 | .container {
10 | position: absolute;
11 | top: 20%;
12 | bottom: 10%;
13 | right: 10%;
14 | left: 30%;
15 | width: auto;
16 | height: auto; }
17 |
18 | .star {
19 | position: relative; }
20 | .star .star-0 {
21 | position: absolute;
22 | width: 0px;
23 | height: 0px;
24 | left: -6.44px;
25 | top: -24.56px;
26 | transform: rotate(0deg);
27 | border-width: 19.88px 6.44px;
28 | /* 高 宽*/
29 | border-style: hidden solid solid solid;
30 | border-color: transparent transparent #FFE066 transparent;
31 | transform-origin: 6.44px 17.76px; }
32 | .star .star-1 {
33 | position: absolute;
34 | width: 0px;
35 | height: 0px;
36 | left: -6.44px;
37 | top: -24.56px;
38 | transform: rotate(72deg);
39 | border-width: 19.88px 6.44px;
40 | /* 高 宽*/
41 | border-style: hidden solid solid solid;
42 | border-color: transparent transparent #FFE066 transparent;
43 | transform-origin: 6.44px 17.76px; }
44 | .star .star-2 {
45 | position: absolute;
46 | width: 0px;
47 | height: 0px;
48 | left: -6.44px;
49 | top: -24.56px;
50 | transform: rotate(144deg);
51 | border-width: 19.88px 6.44px;
52 | /* 高 宽*/
53 | border-style: hidden solid solid solid;
54 | border-color: transparent transparent #FFE066 transparent;
55 | transform-origin: 6.44px 17.76px; }
56 | .star .star-3 {
57 | position: absolute;
58 | width: 0px;
59 | height: 0px;
60 | left: -6.44px;
61 | top: -24.56px;
62 | transform: rotate(216deg);
63 | border-width: 19.88px 6.44px;
64 | /* 高 宽*/
65 | border-style: hidden solid solid solid;
66 | border-color: transparent transparent #FFE066 transparent;
67 | transform-origin: 6.44px 17.76px; }
68 | .star .star-4 {
69 | position: absolute;
70 | width: 0px;
71 | height: 0px;
72 | left: -6.44px;
73 | top: -24.56px;
74 | transform: rotate(288deg);
75 | border-width: 19.88px 6.44px;
76 | /* 高 宽*/
77 | border-style: hidden solid solid solid;
78 | border-color: transparent transparent #FFE066 transparent;
79 | transform-origin: 6.44px 17.76px; }
80 |
81 | .tree {
82 | position: absolute;
83 | width: 0px;
84 | height: 0px;
85 | transform: translateX(-50%);
86 | border-style: hidden solid solid solid;
87 | border-color: transparent transparent #499F68 transparent; }
88 |
89 | .layer-1 {
90 | top: 0;
91 | border-width: 100px 50px;
92 | z-index: 4; }
93 |
94 | .layer-2 {
95 | top: 30px;
96 | border-width: 120px 60px;
97 | z-index: 3; }
98 |
99 | .layer-3 {
100 | top: 50px;
101 | border-width: 160px 80px;
102 | z-index: 2; }
103 |
104 | .layer-4 {
105 | top: 80px;
106 | border-width: 200px 100px;
107 | z-index: 1; }
108 |
109 | .trunk {
110 | position: relative;
111 | top: 280px;
112 | width: 20px;
113 | height: 25px;
114 | transform: translateX(-50%);
115 | background: #84714F; }
116 |
117 | .bubble {
118 | position: absolute;
119 | width: 13px;
120 | height: 13px;
121 | background: #FFE066;
122 | border-radius: 100%; }
123 |
124 | .bubble.one {
125 | top: 65px; }
126 |
127 | .bubble.two {
128 | top: 105px;
129 | left: -30px;
130 | background: red; }
131 |
132 | .bubble.three {
133 | top: 130px;
134 | left: 35px;
135 | background: purple; }
136 |
137 | .bubble.four {
138 | top: 163px;
139 | left: -30px; }
140 |
141 | .loli {
142 | position: absolute;
143 | top: 143px;
144 | left: 40px;
145 | width: 5px;
146 | height: 18px;
147 | background: red;
148 | z-index: 999;
149 | border-top-left-radius: 50% 20%;
150 | border-top-right-radius: 50% 20%;
151 | transform: rotate(-30deg); }
152 | .loli::before {
153 | content: '';
154 | position: absolute;
155 | top: 100%;
156 | transform: translateX(-100%);
157 | border: 10px dashed #499F68;
158 | border-width: 2.5px 2.5px;
159 | border-top-left-radius: 0%;
160 | border-top-right-radius: 0%;
161 | border-bottom-right-radius: 50% 100%;
162 | border-bottom-left-radius: 50% 100%;
163 | z-index: 2; }
164 | .loli::after {
165 | content: '';
166 | position: absolute;
167 | left: 5px;
168 | top: 100%;
169 | transform: translateX(-100%);
170 | border: 10px dashed red;
171 | border-width: 5px 7px;
172 | border-top-left-radius: 0%;
173 | border-top-right-radius: 0%;
174 | border-bottom-right-radius: 50% 100%;
175 | border-bottom-left-radius: 50% 100%; }
176 |
177 | .snow {
178 | position: relative;
179 | top: 125px;
180 | left: -30px;
181 | width: 20px;
182 | height: 20px; }
183 | .snow .stroke {
184 | height: 35px;
185 | width: 2px;
186 | background-color: snow;
187 | position: absolute; }
188 | .snow .stroke::before {
189 | content: "";
190 | position: absolute;
191 | border: 2px solid snow;
192 | border-top: 0;
193 | border-left: 0;
194 | width: 10px;
195 | height: 10px;
196 | left: -5px;
197 | top: -2px;
198 | transform: rotate(45deg);
199 | display: block; }
200 | .snow .stroke::after {
201 | content: "";
202 | position: absolute;
203 | border: 2px solid snow;
204 | border-top: 0;
205 | border-left: 0;
206 | width: 10px;
207 | height: 10px;
208 | left: -5px;
209 | bottom: -2px;
210 | transform: rotate(-135deg);
211 | display: block; }
212 | .snow .stroke-2 {
213 | transform: rotate(90deg); }
214 | .snow .stroke-3 {
215 | transform: rotate(45deg); }
216 | .snow .stroke-4 {
217 | transform: rotate(-45deg); }
218 |
219 | .socks {
220 | position: absolute;
221 | top: 80px;
222 | left: 10px;
223 | z-index: 1;
224 | transform: rotate(10deg); }
225 | .socks::before {
226 | content: '';
227 | position: absolute;
228 | width: 12px;
229 | height: 28px;
230 | background: #E54B4B;
231 | border-top-left-radius: 50% 10%;
232 | border-top-right-radius: 50% 10%; }
233 | .socks::after {
234 | content: '';
235 | position: absolute;
236 | width: 25px;
237 | height: 12px;
238 | top: 22px;
239 | background: #E54B4B;
240 | border-top-right-radius: 50% 40%;
241 | border-bottom-right-radius: 50% 30%; }
242 |
243 | .gift {
244 | position: relative;
245 | top: 240px;
246 | left: 120px;
247 | width: 60px;
248 | height: 40px;
249 | background: #34495e;
250 | z-index: 2; }
251 | .gift::before {
252 | content: '';
253 | position: absolute;
254 | left: 50%;
255 | top: 0%;
256 | width: 16px;
257 | top: -15px;
258 | height: calc(100% + 15px);
259 | transform: translateX(-50%);
260 | background: #fdc56d;
261 | z-index: 5; }
262 | .gift .lid {
263 | position: relative;
264 | width: 80px;
265 | height: 15px;
266 | top: -15px;
267 | left: -8px;
268 | background: #34495e; }
269 | .gift .lid::before {
270 | content: '';
271 | position: absolute;
272 | width: 15px;
273 | height: 13px;
274 | top: -23px;
275 | transform: skew(10deg, 10deg);
276 | border: 7px solid #FFC113;
277 | left: 11px;
278 | border-top-left-radius: 50% 50%;
279 | border-top-right-radius: 50% 50%;
280 | border-bottom-left-radius: 50% 50%; }
281 | .gift .lid::after {
282 | content: '';
283 | position: absolute;
284 | width: 15px;
285 | height: 13px;
286 | top: -23px;
287 | transform: skew(-10deg, -10deg);
288 | border: 7px solid #FFC113;
289 | left: 36px;
290 | border-top-left-radius: 50% 50%;
291 | border-top-right-radius: 50% 50%;
292 | border-bottom-right-radius: 50% 50%; }
293 |
--------------------------------------------------------------------------------
/hiddenface/index.js:
--------------------------------------------------------------------------------
1 | var canvas = document.querySelector('canvas'),
2 | ctx = canvas.getContext('2d');
3 |
4 | canvas.width = document.documentElement.clientWidth;
5 | canvas.height = document.documentElement.clientHeight;
6 |
7 | ctx.translate(0, -85);
8 |
9 | //画无脸男
10 | ctx.beginPath();
11 | ctx.save();
12 | ctx.arc(360, 430, 82, Math.PI + Math.PI / 10, 2 * Math.PI - Math.PI / 10, false);
13 | ctx.stroke();
14 |
15 | ctx.quadraticCurveTo(360 + 82 * Math.cos(Math.PI / 10) + 20, 430 - 82 * Math.sin(Math.PI / 10) + 100,
16 | 360 + 82 * Math.cos(Math.PI / 10) + 32, 430 - 82 * Math.sin(Math.PI / 10) + 300
17 | );
18 |
19 | ctx.lineTo(360 - 82 * Math.cos(Math.PI / 10) - 32, 430 - 82 * Math.sin(Math.PI / 10) + 300);
20 |
21 | ctx.quadraticCurveTo(360 - 82 * Math.cos(Math.PI / 10) - 20, 430 - 82 * Math.sin(Math.PI / 10) + 100,
22 | 360 - 82 * Math.cos(Math.PI / 10), 430 - 82 * Math.sin(Math.PI / 10)
23 | );
24 |
25 | ctx.fill();
26 | ctx.stroke();
27 |
28 | ctx.beginPath();
29 | ctx.save();
30 | ctx.scale(2.5, 0.8);
31 | ctx.arc((360 + 82 * Math.cos(Math.PI / 10) + 32 + 360 - 82 * Math.cos(Math.PI / 10) - 32) / 2 / 2.5,
32 | (430 - 82 * Math.sin(Math.PI / 10) + 300) / 0.8, 44, 0, 2 * Math.PI);
33 | ctx.fill();
34 | ctx.stroke();
35 | ctx.restore();
36 |
37 | //画面具
38 | ctx.beginPath();
39 | ctx.save();
40 | ctx.scale(1.5, 1);
41 | ctx.arc(360 / 1.5, 420, 40, Math.PI, 2 * Math.PI, false);
42 | ctx.quadraticCurveTo(360 / 1.5 + 43, 450, 360 / 1.5 + 39, 480);
43 | ctx.quadraticCurveTo(360 / 1.5 + 35, 500, 360 / 1.5 + 20, 520);
44 | ctx.quadraticCurveTo(360 / 1.5 + 7, 525, 360 / 1.5, 526);
45 | ctx.quadraticCurveTo(360 / 1.5 - 7, 526, 360 / 1.5 - 20, 520);
46 | ctx.quadraticCurveTo(360 / 1.5 - 35, 500, 360 / 1.5 - 39, 480);
47 | ctx.quadraticCurveTo(360 / 1.5 - 43, 450, 360 / 1.5 - 40, 420);
48 | ctx.fillStyle = 'white';
49 | ctx.fill();
50 | ctx.stroke();
51 | ctx.restore();
52 |
53 | //画眼睛
54 | ctx.beginPath();
55 | ctx.arc(360 - 30, 445, 13, 0, 2 * Math.PI);
56 | ctx.arc(360 + 30, 445, 13, 0, 2 * Math.PI);
57 | ctx.fillStyle = 'black';
58 | ctx.fill();
59 |
60 | //画眼纹
61 | ctx.beginPath();
62 | ctx.save();
63 | ctx.scale(1, 4);
64 | ctx.arc((360 - 30) / 1, (445 - 17) / 4, 6, Math.PI, 2 * Math.PI);
65 | ctx.fillStyle = 'red';
66 | ctx.fill();
67 | ctx.restore();
68 |
69 | ctx.beginPath();
70 | ctx.save();
71 | ctx.scale(1, 4);
72 | ctx.arc((360 - 30) / 1, (445 + 17) / 4, 6, 0, Math.PI);
73 | ctx.fillStyle = 'red';
74 | ctx.fill();
75 | ctx.restore();
76 |
77 | ctx.beginPath();
78 | ctx.save();
79 | ctx.scale(1, 4);
80 | ctx.arc((360 + 30) / 1, (445 - 17) / 4, 6, Math.PI, 2 * Math.PI);
81 | ctx.fillStyle = 'red';
82 | ctx.fill();
83 | ctx.restore();
84 |
85 | ctx.beginPath();
86 | ctx.save();
87 | ctx.scale(1, 4);
88 | ctx.arc((360 + 30) / 1, (445 + 17) / 4, 6, 0, Math.PI);
89 | ctx.fillStyle = 'red';
90 | ctx.fill();
91 | ctx.restore();
92 |
93 | //画嘴
94 | ctx.beginPath();
95 | ctx.lineWidth = 5;
96 | ctx.lineCap = "round";
97 | ctx.moveTo(360 - 10, 500);
98 | ctx.lineTo(360 + 10, 500);
99 | ctx.stroke();
100 |
101 | ctx.beginPath();
102 | ctx.lineWidth = 1;
103 | ctx.lineCap = "butt";
104 | ctx.moveTo(360 + 10 + 2.5, 500);
105 | ctx.quadraticCurveTo(360, 509, 360 - 12.5, 500);
106 | ctx.fill();
107 |
108 |
109 | //画左脚
110 | ctx.beginPath();
111 | ctx.moveTo(320, 738);
112 | ctx.lineTo(322, 770);
113 | ctx.lineTo(334, 770);
114 | ctx.lineTo(335, 738);
115 | ctx.fill();
116 |
117 | //画右脚
118 | ctx.beginPath();
119 | ctx.moveTo(400, 738);
120 | ctx.lineTo(401, 770);
121 | ctx.lineTo(415, 770);
122 | ctx.quadraticCurveTo(408, 750, 415, 735);
123 | ctx.fill();
124 |
125 | //画脚下的圆环
126 | ctx.beginPath();
127 | ctx.save();
128 | ctx.scale(4.2, 1);
129 | ctx.arc(360 / 4.2, 770, 15, 0, 2 * Math.PI);
130 | ctx.fill();
131 | ctx.restore();
132 |
133 | //画手
134 | ctx.beginPath();
135 | ctx.save();
136 | ctx.lineCap = "round";
137 | ctx.lineWidth = '10';
138 | ctx.moveTo(248, 518);
139 | ctx.lineTo(270, 548);
140 | ctx.stroke();
141 | ctx.restore();
142 |
143 | //画手指
144 | ctx.beginPath();
145 | ctx.lineCap = "round";
146 | ctx.lineWidth = '7';
147 | ctx.moveTo(248, 518);
148 | ctx.lineTo(245, 518);
149 |
150 | ctx.moveTo(248, 515);
151 | ctx.lineTo(245.5, 515);
152 |
153 | ctx.moveTo(247.5, 510);
154 | ctx.lineTo(246, 510);
155 | ctx.stroke();
156 | ctx.restore();
157 |
158 | //画雨伞渐变线
159 |
160 | ctx.save();
161 | ctx.lineWidth = '1';
162 | ctx.rotate(Math.PI / 30);
163 | ctx.beginPath();
164 | ctx.save();
165 | ctx.scale(2.2, 2.3);
166 | ctx.arc(300 / 2.2, 250 / 2.3, 70, Math.PI, Math.PI * 2);
167 |
168 |
169 | var grd = ctx.createLinearGradient(300, 0, 300, 250);
170 |
171 | grd.addColorStop(0, "#217786");
172 | grd.addColorStop(1, "#1A6180");
173 |
174 | ctx.fillStyle = grd;
175 | ctx.fill();
176 | ctx.stroke();
177 | ctx.restore();
178 |
179 | ctx.beginPath();
180 | ctx.save();
181 | ctx.scale(2.2, 0.7);
182 | ctx.arc(300 / 2.2, 250 / 0.7, 70, 0, Math.PI);
183 | ctx.fillStyle = "#1E6E83";
184 | ctx.fill();
185 | ctx.stroke();
186 | ctx.restore();
187 |
188 |
189 | ctx.beginPath();
190 | ctx.moveTo(300 - 2.2 * 70, 250);
191 | ctx.strokeStyle = "#1E6E83";
192 | ctx.lineTo(300 + 2.2 * 70, 250);
193 | ctx.stroke();
194 | ctx.strokeStyle = "#000";
195 |
196 | ctx.beginPath();
197 | ctx.save();
198 | ctx.scale(1, 2);
199 | ctx.arc(300, 250 / 2, 80, Math.PI - Math.PI / 12, Math.PI * 2 + Math.PI / 12);
200 | ctx.stroke();
201 | ctx.restore();
202 |
203 | ctx.beginPath();
204 | ctx.moveTo(300, 250 - 70 * 2.3);
205 | ctx.quadraticCurveTo(280, 250 + 70 * Math.cos(Math.PI / 4) * 0.2, 294, 250 + 70 * Math.cos(Math.PI / 4));
206 | ctx.stroke();
207 |
208 | ctx.beginPath();
209 | ctx.lineWidth = 5;
210 | ctx.moveTo(300, 250 + 70 * Math.cos(Math.PI / 4));
211 | ctx.lineTo(300, 250 + 70 * Math.cos(Math.PI / 4) + 210);
212 | ctx.stroke();
213 |
214 | ctx.beginPath();
215 | ctx.lineWidth = 8;
216 | ctx.strokeStyle = '#0B3542';
217 | ctx.moveTo(300, 250 + 70 * Math.cos(Math.PI / 4) + 190);
218 | ctx.lineTo(300, 250 + 70 * Math.cos(Math.PI / 4) + 210);
219 | ctx.stroke();
220 |
221 | ctx.beginPath();
222 | ctx.save();
223 | ctx.scale(1, 0.9);
224 | ctx.lineWidth = 8;
225 | ctx.lineCap = "round";
226 | ctx.arc(320, (250 + 70 * Math.cos(Math.PI / 4) + 210) / 0.9, 20, Math.PI / 3.5, Math.PI);
227 | ctx.stroke();
228 | ctx.restore();
229 |
230 | //伞尖下圆环
231 | ctx.beginPath();
232 | ctx.save();
233 | ctx.lineWidth = 1;
234 | ctx.scale(2, 1);
235 | ctx.arc(300 / 2, 250 - 70 * 2.3 + 3, 6, 0, Math.PI * 2);
236 | ctx.fill();
237 | ctx.restore();
238 |
239 | //伞尖
240 | ctx.beginPath();
241 | ctx.moveTo(300 - 5, 250 - 70 * 2.3);
242 | ctx.lineTo(300 + 5, 250 - 70 * 2.3);
243 | ctx.lineWidth = 2;
244 | ctx.lineCap = "round";
245 | ctx.lineTo(301, 250 - 70 * 2.3 - 25);
246 | ctx.lineTo(299, 250 - 70 * 2.3 - 25);
247 | ctx.lineTo(300 - 5, 250 - 70 * 2.3);
248 | ctx.lineCap = "butt";
249 | ctx.fill();
250 | ctx.stroke();
251 |
252 | ctx.restore();
253 | ctx.restore();
254 |
--------------------------------------------------------------------------------
/interestingNote/条状背景/test/test.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
12 |
13 | description
25 |description
33 |description
46 |description
54 |description
67 |description
75 |description
89 |description
97 |description
110 |description
118 |description
132 |description
140 |description
153 |description
161 |description
174 |description
182 |description
196 |description
204 |description
217 |description
225 |description
239 |description
247 |description
260 |description
268 |description
281 |description
289 |description
303 |description
311 |description
323 |description
331 |
16 |
17 |