mirror of
https://github.com/Pomax/BezierInfo-2.git
synced 2025-08-12 11:44:22 +02:00
some cleanup
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{title}</title>
|
||||
|
||||
<!-- opengraph information -->
|
||||
<meta property="og:title" content="A Primer on Bézier Curves">
|
||||
<meta property="og:type" content="text">
|
||||
<meta property="og:url" content="http://pomax.github.io/bezierinfo">
|
||||
<meta property="og:description" content="A detailed explanation of Bézier curves, and how to do the many things that we commonly want to do with them.">
|
||||
<meta property="og:locale" content="en_GB">
|
||||
<meta property="og:type" content="article">
|
||||
<meta property="og:published_time" content="2013-06-13 12:00:00">
|
||||
<meta property="og:author" content="Mike 'Pomax' Kamermans">
|
||||
<meta property="og:section" content="Bézier Curves">
|
||||
<meta property="og:tag" content="Bézier Curves">
|
||||
|
||||
<style>
|
||||
html, body, article { height: 100%; margin: 0; }
|
||||
body { width: 800px; margin: auto; font-size: 4.25mm!important; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<article><div id="article">{content}</div></article>
|
||||
<script src="../lib/site/referrer.js" async></script>
|
||||
</body>
|
||||
</html>
|
@@ -1,38 +0,0 @@
|
||||
var React = require('react');
|
||||
var sections = require('../../components/sections');
|
||||
var Page = require('../../components/Page.jsx');
|
||||
|
||||
module.exports = function generateSingleSection(name) {
|
||||
var Type, entry;
|
||||
|
||||
var buildComponent = function(name, content, compact, entry) {
|
||||
return React.createClass({
|
||||
render: function() {
|
||||
return <Page name={name} compact={compact} prev={entry-1} next={entry+1}>{content}</Page>;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// The root has no "section content".
|
||||
if(name===false) {
|
||||
var notice = (
|
||||
<p className="single-notice">
|
||||
This is the one-page-per-section version of the primer, to view
|
||||
the regular version, please click <a href='..'>here</a>.
|
||||
</p>
|
||||
);
|
||||
return buildComponent('/',notice, true, -1);
|
||||
}
|
||||
|
||||
Object.keys(sections).map((n,idx) => {
|
||||
if (name!==n) return;
|
||||
entry = idx;
|
||||
Type = sections[name];
|
||||
});
|
||||
|
||||
var section = <Type key={name} name={name} number={entry}/>,
|
||||
content = section,
|
||||
SingleSection = buildComponent(name, content, true, entry);
|
||||
|
||||
return SingleSection;
|
||||
};
|
@@ -1,5 +1,5 @@
|
||||
module.exports = {
|
||||
introduction: {
|
||||
window["Bezier Section Handlers"] = {
|
||||
"introduction": {
|
||||
handler: (function() { return {
|
||||
drawQuadratic: function(api) {
|
||||
var curve = api.getDefaultQuadratic();
|
||||
@@ -19,7 +19,7 @@ module.exports = {
|
||||
};
|
||||
}())
|
||||
},
|
||||
whatis: {
|
||||
"whatis": {
|
||||
handler: (function() { return {
|
||||
setup: function(api) {
|
||||
api.setPanelCount(3);
|
||||
@@ -127,7 +127,7 @@ module.exports = {
|
||||
};
|
||||
}())
|
||||
},
|
||||
explanation: {
|
||||
"explanation": {
|
||||
handler: (function() { return {
|
||||
statics: {
|
||||
keyHandlingOptions: {
|
||||
@@ -183,7 +183,7 @@ module.exports = {
|
||||
}()),
|
||||
withKeys: true
|
||||
},
|
||||
control: {
|
||||
"control": {
|
||||
handler: (function() { return {
|
||||
drawCubic: function(api) {
|
||||
var curve = api.getDefaultCubic();
|
||||
@@ -345,7 +345,7 @@ module.exports = {
|
||||
};
|
||||
}())
|
||||
},
|
||||
extended: {
|
||||
"extended": {
|
||||
handler: (function() { return {
|
||||
setupQuadratic: function(api) {
|
||||
var curve = new api.Bezier(70, 155, 20, 110, 100,75);
|
||||
@@ -382,7 +382,7 @@ module.exports = {
|
||||
};
|
||||
}())
|
||||
},
|
||||
decasteljau: {
|
||||
"decasteljau": {
|
||||
handler: (function() { return {
|
||||
setup: function(api) {
|
||||
var points = [
|
||||
@@ -421,7 +421,7 @@ module.exports = {
|
||||
};
|
||||
}())
|
||||
},
|
||||
flattening: {
|
||||
"flattening": {
|
||||
handler: (function() { return {
|
||||
statics: {
|
||||
keyHandlingOptions: {
|
||||
@@ -487,7 +487,7 @@ module.exports = {
|
||||
}()),
|
||||
withKeys: true
|
||||
},
|
||||
splitting: {
|
||||
"splitting": {
|
||||
handler: (function() { return {
|
||||
setupCubic: function(api) {
|
||||
var curve = api.getDefaultCubic();
|
||||
@@ -581,7 +581,7 @@ module.exports = {
|
||||
};
|
||||
}())
|
||||
},
|
||||
reordering: {
|
||||
"reordering": {
|
||||
handler: (function() { var Reordering = {
|
||||
statics: {
|
||||
// Improve this based on http://www.sirver.net/blog/2011/08/23/degree-reduction-of-bezier-curves/
|
||||
@@ -692,7 +692,7 @@ return Reordering;
|
||||
}()),
|
||||
withKeys: true
|
||||
},
|
||||
pointvectors: {
|
||||
"pointvectors": {
|
||||
handler: (function() { return {
|
||||
setupQuadratic: function(api) {
|
||||
var curve = api.getDefaultQuadratic();
|
||||
@@ -727,7 +727,7 @@ return Reordering;
|
||||
};
|
||||
}())
|
||||
},
|
||||
components: {
|
||||
"components": {
|
||||
handler: (function() { return {
|
||||
setupQuadratic: function(api) {
|
||||
var curve = api.getDefaultQuadratic();
|
||||
@@ -774,7 +774,7 @@ return Reordering;
|
||||
};
|
||||
}())
|
||||
},
|
||||
extremities: {
|
||||
"extremities": {
|
||||
handler: (function() { return {
|
||||
setupQuadratic: function(api) {
|
||||
var curve = api.getDefaultQuadratic();
|
||||
@@ -830,7 +830,7 @@ return Reordering;
|
||||
};
|
||||
}())
|
||||
},
|
||||
boundingbox: {
|
||||
"boundingbox": {
|
||||
handler: (function() { return {
|
||||
setupQuadratic: function(api) {
|
||||
var curve = api.getDefaultQuadratic();
|
||||
@@ -857,7 +857,7 @@ return Reordering;
|
||||
};
|
||||
}())
|
||||
},
|
||||
aligning: {
|
||||
"aligning": {
|
||||
handler: (function() { return {
|
||||
setupQuadratic: function(api) {
|
||||
var curve = api.getDefaultQuadratic();
|
||||
@@ -914,7 +914,7 @@ return Reordering;
|
||||
};
|
||||
}())
|
||||
},
|
||||
tightbounds: {
|
||||
"tightbounds": {
|
||||
handler: (function() { return {
|
||||
setupQuadratic: function(api) {
|
||||
var curve = api.getDefaultQuadratic();
|
||||
@@ -988,7 +988,7 @@ return Reordering;
|
||||
};
|
||||
}())
|
||||
},
|
||||
inflections: {
|
||||
"inflections": {
|
||||
handler: (function() { return {
|
||||
setupCubic: function(api) {
|
||||
var curve = new api.Bezier(135,25, 25, 135, 215,75, 215,240);
|
||||
@@ -1008,7 +1008,7 @@ return Reordering;
|
||||
};
|
||||
}())
|
||||
},
|
||||
canonical: {
|
||||
"canonical": {
|
||||
handler: (function() { return {
|
||||
setup: function(api) {
|
||||
var curve = api.getDefaultCubic();
|
||||
@@ -1170,7 +1170,7 @@ return Reordering;
|
||||
};
|
||||
}())
|
||||
},
|
||||
arclength: {
|
||||
"arclength": {
|
||||
handler: (function() { var sin = Math.sin;
|
||||
var tau = Math.PI*2;
|
||||
|
||||
@@ -1264,7 +1264,7 @@ return {
|
||||
};
|
||||
}())
|
||||
},
|
||||
arclengthapprox: {
|
||||
"arclengthapprox": {
|
||||
handler: (function() { return {
|
||||
statics: {
|
||||
keyHandlingOptions: {
|
||||
@@ -1326,7 +1326,7 @@ return {
|
||||
}()),
|
||||
withKeys: true
|
||||
},
|
||||
tracing: {
|
||||
"tracing": {
|
||||
handler: (function() { return {
|
||||
statics: {
|
||||
keyHandlingOptions: {
|
||||
@@ -1456,7 +1456,7 @@ return {
|
||||
}()),
|
||||
withKeys: true
|
||||
},
|
||||
intersections: {
|
||||
"intersections": {
|
||||
handler: (function() { var min = Math.min, max = Math.max;
|
||||
|
||||
return {
|
||||
@@ -1534,7 +1534,7 @@ return {
|
||||
};
|
||||
}())
|
||||
},
|
||||
curveintersection: {
|
||||
"curveintersection": {
|
||||
handler: (function() { var abs = Math.abs;
|
||||
|
||||
return {
|
||||
@@ -1654,7 +1654,7 @@ return {
|
||||
};
|
||||
}())
|
||||
},
|
||||
abc: {
|
||||
"abc": {
|
||||
handler: (function() { return {
|
||||
onClick: function(evt, api) {
|
||||
api.t = api.curve.on({x: evt.offsetX, y: evt.offsetY},7);
|
||||
@@ -1779,7 +1779,7 @@ return {
|
||||
};
|
||||
}())
|
||||
},
|
||||
moulding: {
|
||||
"moulding": {
|
||||
handler: (function() { var abs = Math.abs;
|
||||
|
||||
return {
|
||||
@@ -1981,7 +1981,7 @@ return {
|
||||
};
|
||||
}())
|
||||
},
|
||||
pointcurves: {
|
||||
"pointcurves": {
|
||||
handler: (function() { var abs = Math.abs;
|
||||
|
||||
return {
|
||||
@@ -2148,7 +2148,7 @@ return {
|
||||
};
|
||||
}())
|
||||
},
|
||||
catmullmoulding: {
|
||||
"catmullmoulding": {
|
||||
handler: (function() { return {
|
||||
statics: {
|
||||
keyHandlingOptions: {
|
||||
@@ -2283,7 +2283,7 @@ return {
|
||||
}()),
|
||||
withKeys: true
|
||||
},
|
||||
polybezier: {
|
||||
"polybezier": {
|
||||
handler: (function() { var atan2 = Math.atan2, sqrt = Math.sqrt, sin = Math.sin, cos = Math.cos;
|
||||
|
||||
return {
|
||||
@@ -2527,7 +2527,7 @@ return {
|
||||
};
|
||||
}())
|
||||
},
|
||||
shapes: {
|
||||
"shapes": {
|
||||
handler: (function() { var modes;
|
||||
|
||||
return {
|
||||
@@ -2619,7 +2619,7 @@ return {
|
||||
};
|
||||
}())
|
||||
},
|
||||
projections: {
|
||||
"projections": {
|
||||
handler: (function() { return {
|
||||
setup: function(api) {
|
||||
api.setSize(320,320);
|
||||
@@ -2677,7 +2677,7 @@ return {
|
||||
};
|
||||
}())
|
||||
},
|
||||
offsetting: {
|
||||
"offsetting": {
|
||||
handler: (function() { return {
|
||||
statics: {
|
||||
keyHandlingOptions: {
|
||||
@@ -2739,7 +2739,7 @@ return {
|
||||
}()),
|
||||
withKeys: true
|
||||
},
|
||||
graduatedoffset: {
|
||||
"graduatedoffset": {
|
||||
handler: (function() { return {
|
||||
statics: {
|
||||
keyHandlingOptions: {
|
||||
@@ -2780,7 +2780,7 @@ return {
|
||||
}()),
|
||||
withKeys: true
|
||||
},
|
||||
circles: {
|
||||
"circles": {
|
||||
handler: (function() { var sin = Math.sin,
|
||||
cos = Math.cos;
|
||||
|
||||
@@ -2840,7 +2840,7 @@ return {
|
||||
};
|
||||
}())
|
||||
},
|
||||
circles_cubic: {
|
||||
"circles_cubic": {
|
||||
handler: (function() { var sin = Math.sin, cos = Math.cos, tan = Math.tan;
|
||||
|
||||
return {
|
||||
@@ -3048,7 +3048,7 @@ return {
|
||||
};
|
||||
}())
|
||||
},
|
||||
arcapproximation: {
|
||||
"arcapproximation": {
|
||||
handler: (function() { var atan2 = Math.atan2, PI = Math.PI, TAU = 2*PI, cos = Math.cos, sin = Math.sin;
|
||||
|
||||
return {
|
||||
@@ -3212,7 +3212,7 @@ return {
|
||||
}()),
|
||||
withKeys: true
|
||||
},
|
||||
bsplines: {
|
||||
"bsplines": {
|
||||
handler: (function() { return {
|
||||
basicSketch: require('./basic-sketch'),
|
||||
interpolationGraph: require('./interpolation-graph'),
|
||||
|
@@ -1,18 +0,0 @@
|
||||
module.exports = function(title, html) {
|
||||
return [
|
||||
"<!doctype html>",
|
||||
"<html>",
|
||||
"<head>",
|
||||
"<meta charset='utf-8'>",
|
||||
"<title>",
|
||||
title,
|
||||
"</title>",
|
||||
"<base href='..'>",
|
||||
"</head>",
|
||||
"<body>",
|
||||
html,
|
||||
"</body>",
|
||||
"</html>"
|
||||
].join('\n');
|
||||
};
|
||||
|
@@ -1,31 +0,0 @@
|
||||
var React = require('react');
|
||||
var ReactRouter = require('react-router');
|
||||
var Router = ReactRouter.Router;
|
||||
var Route = ReactRouter.Route;
|
||||
|
||||
var Page = require("../../components/Page.jsx");
|
||||
|
||||
// get all the sections, and generate <Route> objects for each.
|
||||
var sections = require("../../components/sections");
|
||||
var generateSingleSection = require("./generateSingleSection");
|
||||
var pageIDs = Object.keys(sections);
|
||||
|
||||
// Then we generate each page's <Route>
|
||||
var rootComponent = generateSingleSection(false);
|
||||
var root = <Route path={'/'} component={rootComponent} key={'/'}/>;
|
||||
var pages = [root].concat(
|
||||
pageIDs.map(id => {
|
||||
<Route path={id} component={generateSingleSection(id)} key={id}/>
|
||||
})
|
||||
);
|
||||
|
||||
// And finally, the full app's route set, set to use "URL" rather than "hash" navigation.
|
||||
// var createBrowserHistory = require('history/lib/createBrowserHistory');
|
||||
// var history = createBrowserHistory();
|
||||
module.exports = {
|
||||
sections: sections,
|
||||
paths: pageIDs,
|
||||
routes: pages,
|
||||
rootComponent: rootComponent,
|
||||
RouteSet: <Router>{pages}</Router>
|
||||
};
|
@@ -3,12 +3,13 @@
|
||||
"version": "2.0.0",
|
||||
"description": "pomax.github.io/bezierinfo",
|
||||
"scripts": {
|
||||
"bootstrap": "run-s makeindex localize",
|
||||
"bootstrap": "run-s makeindex makehandlers localize",
|
||||
"localize": "node tools/make-locales",
|
||||
"prebuild": "node tools/buildmark -- set",
|
||||
"build": "run-s bootstrap less build:** default",
|
||||
"default": "node tools/copy-default-locale",
|
||||
"postbuild": "node tools/buildmark -- resolve",
|
||||
"makehandlers": "node tools/aggregate-js-handlers",
|
||||
"makeindex": "node tools/form-section-index-files",
|
||||
"build:en-GB": "webpack -p",
|
||||
"build:zh-CN": "cross-env LOCALE=zh-CN webpack -p",
|
||||
|
@@ -21,7 +21,7 @@ Object.keys(index).forEach( section => {
|
||||
let content = fs.readFileSync(handlerFile).toString();
|
||||
content = content.replace("module.exports = ","return ");
|
||||
content = `(function() { ${content} }())`;
|
||||
let def = ` ${section}: {
|
||||
let def = ` "${section}": {
|
||||
handler: ${content}`;
|
||||
if (content.indexOf('keyHandlingOptions') > -1) { def += `,\n withKeys: true`; }
|
||||
def += `\n }`;
|
||||
@@ -29,5 +29,5 @@ Object.keys(index).forEach( section => {
|
||||
}
|
||||
});
|
||||
|
||||
var masterFile = `module.exports = {\n${ handlers.join(',\n') }\n};\n`;
|
||||
var masterFile = `window["Bezier Section Handlers"] = {\n${ handlers.join(',\n') }\n};\n`;
|
||||
fs.writeFileSync(path.join(BASEDIR, "lib/site/handlers.js"), masterFile);
|
||||
|
Reference in New Issue
Block a user