In the previous article, I mentioned that there was a Japanese who made a very powerful JS canvas library and could convert Javascript into Silverlight.
This time he needs to use his function library, address in http://www.cnblogs.com/libinqq/archive/2009/01/08/1371676.html
Next I will talk about how to plot. It is very simple. We just need to create a JS array and a user-friendly output interface (as shown below ).
Code
Function boot (){
Draw (document. getelementbyid ( ' Canvas ' ));
Draw (document. getelementbyid ( ' Vmlcanvas ' ));
}
Function draw (e ){
VaR dot =
" 11111 " +
" 111111111 " +
" 2223323 " +
" 2323332333 " +
" 23223332333 " +
" 2233332222 " +
" 3333333 " +
" 221222 " +
" 2221221222 " +
" 222211112222 " +
" 332131131233 " +
" 331111111133 " +
" 111 111 " +
" 222 222 " +
" 2222 2222 " ;
VaR ary = Dot. Split ( "" );
VaR data = [];
VaR I, iz;
For (I = 0 , Iz = Ary. length; I < Iz; ++ I ){
Switch (Parseint (ary [I]) | 0 ){
Case 0 : Data. Push ( "" ); Break ;
Case 1 : Data. Push ( " # Ff3900 " ); Break ;
Case 2 : Data. Push ( " # Ad7b00 " ); Break ;
Case 3 : Data. Push ( " # Ffa542 " ); Break ;
}
}
UU. Draw (e). Scale ( 5 , 5 ). Icon ( 5 , 25 , 12 , 15 , Data );
}
The aboveCodeWe can draw a drawing array and split the output directly below.
Note the following. Icon (X axis, Y axis, array width, array height)
(I painted it myself)
We can access our view array as an object to call or make animations multiple times.
There is no need to worry about browser compatibility, because this library is highly compatible. in IE, it will convert JS Code into Silverlight. If the client does not install
Silverlight,ProgramIt will be resolved to VML, and Firefox and Google will be more compatible because they support Canvas elements.
If the game is the first choice, because the Silverlight speed is quite good, and both are expressed in the X and Y axes, as long as we define the canvas, we do not need HTML Div.
Because the canvas is a whole area or control.