-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolors.php
55 lines (40 loc) · 1.48 KB
/
colors.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php include 'includes/head.php'; ?>
<?php include 'includes/nav.php'; ?>
<div style="width: 100%; padding: 20px; font-family: monospace; border: 1px dashed #fcc" id="frames"></div><br>
<br>
<canvas id="stage" width="800" height="400"></canvas><br>
<script src="js/grafix.nocache.js"></script>
<script>
var stage = Grafix.stage( '#stage' );
stage.color = Grafix.colors.black;
var grid = Grafix.grid( {
width: stage.width,
height: stage.height,
virtual: false,
align: 'center center',
drawStyle: 'stroke',
color: 'blue',
columns: 10,
rows: 10,
allowIndividualStyles: true
} )
.eachRect( function( x, y, i ) {
// We are able to use our own style!
this.drawStyle = 'fill';
// Test a random color
this.color = Grafix.Color.rgbToHex(Grafix.Random.int(0, 255), Grafix.Random.int(0, 255), Grafix.Random.int(0, 255));
/*
if( y === 0 ) {
var c = Grafix.color( { h: x, s: .5, l: .5 } );
console.log( String( c ), c.hex, x, { h: x, s: .5, l: .5 } );
this.color = c.hex;
}
*/
} );
stage.addChild( [ grid ] );
var frameCount = 0;
stage.update( function( e ) {
document.getElementById( 'frames' ).innerHTML = ++frameCount;
} ).start( true );
</script>
<?php include 'includes/foot.php'; ?>