diff --git a/README.md b/README.md index 7a0093f..f13d5f0 100644 --- a/README.md +++ b/README.md @@ -25,4 +25,4 @@ console.log( x ); // result: 1 ### Support ### -If you want to support **Tau.js**, leave a comment on our support issue #1 or contribute another example. \ No newline at end of file +If you want to support **Tau.js**, leave a comment on the [support issue](https://github.com/egraether/Tau.js/issues/1) or contribute another example. diff --git a/examples/taujs.html b/examples/taujs.html index 399886c..7ff2047 100644 --- a/examples/taujs.html +++ b/examples/taujs.html @@ -16,7 +16,8 @@ input { text-align: right; } #info { float: left; width: 400px; margin-right: 20px; } - #controls { margin-top: 24pt; padding-top: 16pt; border-top: 2px solid #666; } + #controls { margin-top: 24px; padding-top: 16pt; border-top: 2px solid #666; } + .unit { margin-right: 30px; } #tauWrapper { float: left; width: 500px; position: relative; } #tauCanvas { position: absolute; background-color: '#FFF'; } @@ -32,23 +33,32 @@
-

Tau.js

+

Tau.js

- A JavaScript library that provides τ,
a simpler alternative to π. + A JavaScript library that provides τ,
+ a simpler alternative to π.

- Learn more about how τ reduces complexity at + Learn more about why τ reduces complexity at The Tau Manifesto.

+

Download source at github.

+ +

Enter your desired angle:

+

- Download source at github. -

+ + ° + + + π + + + τ -

Enter your desired angle: -

@@ -69,12 +79,13 @@

Tau.js

var canvas = document.getElementById( 'tauCanvas' ), display = document.getElementById( 'tauDisplay' ), - input = document.getElementById( 'tauAngle' ), + degreeInput = document.getElementById( 'degreeAngle' ), + piInput = document.getElementById( 'piAngle' ), + tauInput = document.getElementById( 'tauAngle' ), ctx = canvas.getContext( '2d' ), - size = 500, - radius = 235, - current = 0, - aim = 0.28; + size = 500, radius = 235, + current = 0, aim, + degreeValue, piValue, tauValue; canvas.width = canvas.height = size; ctx.lineWidth = 6; @@ -178,13 +189,33 @@

Tau.js

}; + function aimAt( value ) { + + aim = value; + + degreeInput.value = degreeValue = Math.floor( value * 360 ); + piInput.value = piValue = ( value * 2 ).toFixed( 2 ); + tauInput.value = tauValue = value.toFixed( 2 ); + + }; + function evaluate() { - var value = parseFloat( input.value ); + var newDegreeValue = parseFloat( degreeInput.value ), + newPiValue = parseFloat( piInput.value ), + newTauValue = parseFloat( tauInput.value ); + + if ( newDegreeValue !== NaN && degreeValue != newDegreeValue ) { + + aimAt( newDegreeValue / 360 ); + + } else if ( newPiValue !== NaN && piValue != newPiValue ) { + + aimAt( newPiValue / 2 ); - if ( value !== NaN ) { + } else if ( newTauValue !== NaN && tauValue != newTauValue ) { - aim = value; + aimAt( newTauValue ); } @@ -200,6 +231,7 @@

Tau.js

} + aimAt( Math.random() * 0.5 + 0.1 ); run();