Skip to content

Commit b499781

Browse files
committed
single round-trip animation
1 parent 50f1834 commit b499781

File tree

7 files changed

+472
-103
lines changed

7 files changed

+472
-103
lines changed

site/_core/Prism.js

Lines changed: 35 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,39 @@
11
var React = require('react');
2-
var unindent = require('./unindent');
2+
3+
export default function PrismComponent(props) {
4+
const lines = [];
5+
if (props.line) {
6+
props.line.split(',').forEach(range => {
7+
const parts = range.split('-');
8+
if (parts.length === 1) {
9+
lines.push(parts[0].trim());
10+
} else {
11+
const start = parseInt(parts[0].trim(), 10);
12+
const end = parseInt(parts[1].trim(), 10);
13+
for (let ii = start; ii <= end; ii++) {
14+
lines.push(ii);
15+
}
16+
}
17+
});
18+
}
19+
20+
const language = props.language || 'javascript';
21+
const grammar = _.languages[language];
22+
return (
23+
<pre className={'prism language-' + language}>
24+
{Token.reactify(_.tokenize(props.children, grammar))}
25+
{lines.map(function(line, ii) {
26+
return (
27+
<div
28+
className="line-highlight"
29+
key={ii}
30+
style={{height: 20, top: 20 * (line - 1)}}
31+
/>
32+
);
33+
})}
34+
</pre>
35+
);
36+
}
337

438
/* http://prismjs.com/download.html?themes=prism&languages=markup+clike+javascript+jsx */
539
/**
@@ -516,48 +550,3 @@ Prism.languages.insertBefore('inside', 'attr-value',{
516550
}, Prism.languages.jsx.tag);
517551

518552
}(Prism));
519-
520-
var PrismComponent = React.createClass({
521-
statics: {
522-
_: _
523-
},
524-
getDefaultProps: function() {
525-
return {
526-
language: 'javascript'
527-
};
528-
},
529-
render: function() {
530-
var lines = [];
531-
if (this.props.line) {
532-
this.props.line.split(',').forEach(function(range) {
533-
var parts = range.split('-');
534-
if (parts.length === 1) {
535-
lines.push(parts[0].trim());
536-
} else {
537-
var start = parseInt(parts[0].trim(), 10);
538-
var end = parseInt(parts[1].trim(), 10);
539-
for (var ii = start; ii <= end; ii++) {
540-
lines.push(ii);
541-
}
542-
}
543-
});
544-
}
545-
var grammar = _.languages[this.props.language];
546-
return (
547-
<pre className={'prism language-' + this.props.language}>
548-
{Token.reactify(_.tokenize(this.props.children, grammar))}
549-
{lines.map(function(line, ii) {
550-
return (
551-
<div
552-
className="line-highlight"
553-
key={ii}
554-
style={{height: 20, top: 20 * (line - 1)}}
555-
/>
556-
);
557-
})}
558-
</pre>
559-
);
560-
}
561-
})
562-
563-
module.exports = PrismComponent;

site/_core/unindent.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

site/_css/index.less

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,95 @@ body.index {
166166
padding-top: 4em;
167167
padding-bottom: 4em;
168168

169-
& > div {
169+
.prose {
170170
max-width: 415px;
171171
}
172172
}
173173

174+
section.point2 {
175+
display: flex;
176+
align-items: center;
177+
justify-content: space-between;
178+
padding-top: 4em;
179+
padding-bottom: 4em;
180+
181+
.prose {
182+
max-width: 415px;
183+
}
184+
185+
.app-to-server {
186+
width: 476px;
187+
height: 370px;
188+
position: relative;
189+
190+
& > img {
191+
position: absolute;
192+
top: -35px;
193+
left: -10px;
194+
right: -10px;
195+
}
196+
197+
.query, .response {
198+
position: absolute;
199+
200+
.prism {
201+
box-shadow: none;
202+
background: none;
203+
}
204+
}
205+
206+
.query {
207+
animation: query-up 6s 0s infinite ease-in both;
208+
left: 155px;
209+
210+
@keyframes query-up {
211+
from {
212+
opacity: 0;
213+
top: 160px;
214+
}
215+
216+
5%, 25% {
217+
opacity: 1;
218+
}
219+
220+
40% {
221+
opacity: 0;
222+
}
223+
224+
50%, 100% {
225+
top: 90px;
226+
opacity: 0;
227+
}
228+
}
229+
}
230+
231+
.response {
232+
animation: response-down 6s 2.3s infinite ease-out both;
233+
left: 115px;
234+
235+
@keyframes response-down {
236+
0% {
237+
opacity: 0;
238+
top: 70px;
239+
}
240+
241+
10% {
242+
opacity: 0;
243+
}
244+
245+
25%, 45% {
246+
opacity: 1;
247+
}
248+
249+
50%, 100% {
250+
opacity: 0;
251+
top: 130px;
252+
}
253+
}
254+
}
255+
}
256+
}
257+
174258
.home-divider {
175259
border-top-color: #bbb;
176260
margin: 3em auto;

site/_css/prism.less

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
-ms-hyphens: none;
3636
hyphens: none;
3737

38-
white-space: pre-wrap;
39-
4038
font-size: 13px;
4139
line-height: 17px;
4240
background: white;

site/img/phone.svg

Lines changed: 43 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)