Skip to content

Commit

Permalink
updated demo
Browse files Browse the repository at this point in the history
  • Loading branch information
roblarsen committed Dec 15, 2014
1 parent edaaa14 commit d1c9117
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 2 deletions.
5 changes: 4 additions & 1 deletion assets/stylesheets/styles.css
Expand Up @@ -106,7 +106,10 @@ header {
float:left;
position:fixed;
}

#demo header {
position:static;
float:none;
}
header ul {
list-style:none;
height:40px;
Expand Down
10 changes: 9 additions & 1 deletion demo/index.html
Expand Up @@ -5,11 +5,15 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Cee.js: Demo</title>
<meta name="description" content="Cee.js demos">
<link href="../assets/stylesheets/styles.css" rel="stylesheet" type="text/css">
</head>

<body>
<body id="demo">

<header>
<h1>Cee JS
</h1>
</header>
<h2>Demos</h2>
<ul>
<li>
Expand Down Expand Up @@ -48,6 +52,10 @@ <h2>Demos</h2>
<li>
<a href="fillCircle.html">fillCircle</a>
</li>
<li>
<a href="logoz.html">Logo (animated with the longest chain in history)</a>
</li>

<li>
<a href="line.html">Line</a>
</li>
Expand Down
62 changes: 62 additions & 0 deletions demo/koch-orig.html
@@ -0,0 +1,62 @@
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<title>CanvasJS Demo</title>
</head>
<body>
<canvas id="demo" height="1000" width="1000">
</canvas>

<script src="../Canvas.js"></script>
<script>
(function(){
"use strict"
var ctx = new Canvas("demo");
function koch( x, y, length, level ) {
ctx.save().moveTo(x,y)
.beginPath()
.line({
angle : -45,
distance : length,
})
.line({
angle : 45,
distance : length,
})
.line({
angle : 0,
distance : length,
})
.stroke()
.restore();

if (level <1000) {
koch( ctx.currentPos().x, ctx.currentPos().y, length/3, level+1);
}

}
function init(){
/*
if level < 1 then
Move forward length pixels
else
Draw a k-1 level Koch curve with segments 1/3 the current length
Turn left 60 degrees
Draw a k-1 level Koch curve with segments 1/3 the current length
Turn right 120 degrees
Draw a k-1 level Koch curve with segments 1/3 the current length
Turn left 60 degrees
Draw a k-1 level Koch curve with segments 1/3 the current length
*/
koch( 500, 500, 500, 1 );
}
return {
init : init
}})().init( demo );



</script>
</body>
</html>
47 changes: 47 additions & 0 deletions demo/spiral.html
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<title>CanvasJS Arc Demo</title>
</head>
<body>
<canvas id="demo" height="500" width="960">
</canvas>

<script src="../Canvas.js"></script>
<script>
(function(){
"use strict"
function init(){
var ctx = new Canvas("demo"),
int1 = 0,
int2 = 1,
int3,
angle = 0;
for (var i = 3; i <= 30; i++) {
angle = angle+9;
int3 = int1 + int2;
int1 = int2;
int2 = int3;
ctx.beginPath()
.line({
"distance" : int3/Math.PI,
"angle" : int3,
"x" : 400,
"y" : 20
})
.arc( ctx.currentPos().x, ctx.currentPos().y, int3, ctx.math.radians( angle), ctx.math.radians(0 ), true )
.stroke()
.closePath()
}
}

return {
init : init
}})().init();



</script>
</body>
</html>

0 comments on commit d1c9117

Please sign in to comment.