File: demo-example-regular-polygon.html

Recommend this page to a friend!
  Classes of Daniel Martinez  >  Regular Polygon Generator  >  demo-example-regular-polygon.html  >  Download  
File: demo-example-regular-polygon.html
Role: Example script
Content type: text/plain
Description: Demo example
Class: Regular Polygon Generator
Generate and draw regular polygons on a canvas
Author: By
Last change:
Date: 9 years ago
Size: 945 bytes
 

Contents

Class file image Download
<!--
/*
 * ---------------------------------------------
 * Project: Regular Polygon generator
 * Autor: Daniel Martinez <www.webofilia.com>
 * ---------------------------------------------
 */
-->
<script src="RegularPolygon.js" type="text/javascript"></script>


<h4>Demo Example</h4>

<canvas id="canvasPol" width="400" height="400" style="border:1px solid #ccc">This browser doesn't support Canvas element</canvas>

<script type="text/javascript">
        
    //Triangle  
	var Triangle= {
		n:3,
		strokeStyle:'#333',
		fillStyle:'#528B8B',
		lineWidth:4,
		lSide:250,
		x:315,
		y:370,
		rotationAngle:180
	};
	
	//Pentagon
	var Pentagon = {
		n:5,
		strokeStyle:'#666',
		fillStyle:'#b21303',
		lineWidth:5,
		lSide:75,
		x:25,
		y:70,
		rotationAngle:0
	};
	
	var rpGen = new RegularPolygonGenerator('canvasPol');
        
	rpGen.generate(Triangle,Pentagon);
	rpGen.draw();
      
</script>