0

Hy every body, what I am making is some functions for other people to make figures with pixels.
So I put two documents:
imagepixel.html

<!doctype html>
<html>
   <head>
      <meta name="author" content="Someone"/>
      <meta name="description" content="my webpage ..."/>
      <meta name="keywords" content="my, webpage"/>
      <title>image by pixel</title>
      <script language="JavaScript" type="text/javascript" src="imagepixel.js"></script>
      <script language="JavaScript" type="text/javascript">
         <!--
         window.onload=function(){		          
            square(document.getElementById("figure"),"rgb(0,0,50)",400,20,70,20,70,1)
         }
         //-->
      </script>
     <title>Untitled</title>
   </head>
   <body>
      <div id="figure"></div>
      ...
   </body>
</html>

imagepixel.js

function pixel(location,color,zoom,px,py,pz)
{
   location.insertAdjacentHTML("beforeBegin","<span style='background-color:"+color+";width:"+zoom+"px;height:"+zoom+"px;font-size:"+zoom+"px;position:absolute;left:"+px*pz+";top:"+py*pz+";z-index:"+pz+"'></span>")
}
function square(squareLocation,squareColor,zoomSquare,xi,xf,yi,yf,z)
{				 
   for(x=xi;x<xf;x+=(zoomSquare/z)){											 
      for(y=yi;y<yf;y+=(zoomSquare/z)){													 										  
         pixel(squareLocation,squareColor,zoomSquare,x,y,z)	
      }												  
   }
}

I want to put a code for triangles like this

function triangle(triangleLocation,triangleColor,triangleZoom,x1,y1,x2,y2,x3,y3)
{
   ...
}

How could I make the triangle function?
you can youse Js, HTML and CSS
don't youse JQuery or Ajax

Edited by louiscos77: n/a

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by louiscos77
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.