Permalink
Browse files

now there are 2 rotating discs

  • Loading branch information...
Dan Newcome
Dan Newcome committed Nov 21, 2011
1 parent e050c9d commit a607ae436b8af2adb6b9653833dffbc6c83aad7d
Showing with 9 additions and 8 deletions.
  1. +9 −8 samples/cdj.html
View
@@ -7,39 +7,40 @@
<script>
var offset = 0;
function draw() {
- var paper = Donatello.paper('paper-div', 20, 20, 500, 500 );
+ document.getElementById('paper-div').innerHTML = "";
+ var paper = Donatello.paper('paper-div', 20, 20, 800, 500 );
paper.attr( {fill:'black'} );
- main( paper );
+ main( paper, 200, 250 );
+ main( paper, 600, 250 );
+ offset += 5;
}
function main( paper, centerx, centery ) {
var offsetRad = offset*Math.PI/180;
- document.getElementById('paper-div').innerHTML = "";
var colors = [
'#717171', '#A71717', '#8AA717', '#34A717', '#17A751', '#17A7A7', '#1751A7', '#3417A7'
];
- paper.circle( 250, 250, 125, {
+ paper.circle( centerx, centery, 125, {
stroke:'gray',
'stroke-width': 1,
// 'fill': '#c1c1c1',
'backgroundImage': Donatello.createLinearGradient( 90, '#000000', '#FFFFFF' ),
} );
- paper.circle( 250, 250, 120, { stroke:'#9f9f9f', 'stroke-width': 1, 'fill': '#c1c1c1' } );
- paper.circle( 250, 250, 100, { stroke:'white', 'stroke-width': 1, 'fill': 'grey' } );
+ paper.circle( centerx, centery, 120, { stroke:'#9f9f9f', 'stroke-width': 1, 'fill': '#c1c1c1' } );
+ paper.circle( centerx, centery, 100, { stroke:'white', 'stroke-width': 1, 'fill': 'grey' } );
var r = 110;
for( var i=0; i < 16; i ++ ) {
var x = Math.cos( i*Math.PI/8+offsetRad )*r;
var y = Math.sin( i*Math.PI/8+offsetRad )*r;
- var circle = paper.ellipse( 250 + x, 250 + y, 9, 7, {
+ var circle = paper.ellipse( centerx + x, centery + y, 9, 7, {
'stroke-width': 0,
'stroke': 'grey',
'stroke-style': 'solid',
'backgroundImage': Donatello.createLinearGradient( (i*Math.PI/8+offsetRad)*180/Math.PI, '#000000', '#FFFFFF' ),
});
// circle.rotate( (i*Math.PI/4)*180/Math.PI );
circle.rotate( (i*Math.PI/8+offsetRad)*180/Math.PI+90 );
- offset += 0.4;
}
}
</script>

0 comments on commit a607ae4

Please sign in to comment.