Revision: 1052
Author: allain.lalonde
Date: Thu Aug 26 12:26:01 2010
Log: Improving examples
http://code.google.com/p/piccolo2d/source/detail?r=1052
Modified:
/piccolo2d.js/trunk/examples/activities.html
/piccolo2d.js/trunk/examples/calendar.html
=======================================
--- /piccolo2d.js/trunk/examples/activities.html Mon Jan 4 10:15:57 2010
+++ /piccolo2d.js/trunk/examples/activities.html Thu Aug 26 12:26:01 2010
@@ -57,7 +57,7 @@
bounds: new PBounds(0, 0, 400, 400)
})
- for (var i=0; i<100; i++) {
+ for (var i=0; i < 1000; i++) {
var randomColor = "rgb("+(Math.round(Math.random()*254)) + ","
+(Math.round(Math.random()*254)) + "," +(Math.round(Math.random()*254))
+")";
squareContainer.addChild(new PNode({
fillStyle: randomColor,
@@ -91,7 +91,7 @@
<h1>Activity Example</h1>
<p>This example contains:</p>
<ul>
- <li>100 Rectangles being scheduled every 1.5 seconds for 1 second.</li>
+ <li>1000 Rectangles being scheduled every 1.5 seconds for 1
second.</li>
</ul>
</body>
</html>
=======================================
--- /piccolo2d.js/trunk/examples/calendar.html Mon Jan 4 10:15:57 2010
+++ /piccolo2d.js/trunk/examples/calendar.html Thu Aug 26 12:26:01 2010
@@ -57,13 +57,22 @@
pCanvas.fillStyle = "rgb(0, 0, 0)";
var Day = PNode.extend({
- init: function (number) {
+ init: function (number, tasks) {
this._super({
bounds: new PBounds(0, 0, columnWidth*5, 500),
fillStyle: number ? "rgb(255, 255,
255)" : "rgb(200, 200, 200)"
});
this.addChild(new PText("" +
number).scale(5).translate(10, 10));
+
+
+ if (tasks) {
+ var taskNode = new PNode();
+ for (var i=0; i<tasks.length; i++) {
+ taskNode.addChild(new PText(tasks[i]).translate(0,
30 * i));
+ }
+ this.addChild(taskNode.translate(10, 130));
+ }
},
paintAfterChildren: function (ctx) {
@@ -108,7 +117,8 @@
var currentDay = 0;
while (currentDay < daysInMonth) {
var dayLabel = currentDay < 0 ? "" : (currentDay +
1);
- this.addChild(new
Day(dayLabel).translate(columnNumber*columnWidth, currentY).scale(0.2));
+ var tasks = ["Testing 1, 2, 3", "Testing
Again", "Kilroy was here", "Random again", "Testing 1, 2, 3", "Testing
Again", "Kilroy was here", "Random again"];
+ this.addChild(new Day(dayLabel,
tasks).translate(columnNumber*columnWidth, currentY).scale(0.2));
currentDay += 1;
columnNumber += 1;
@@ -179,5 +189,7 @@
</script>
<h1>Calendar Example</h1>
<p>Benchmarking example mostly.</p>
+
+ <p># of nodes being rendered is <strong>4123</strong> = 365 * 11 + 12
* (2 + 7)!</p>
</body>
</html>
--
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en