Skip to content

Commit 3151355

Browse files
committed
Expand the grid size of the Multiply test automatically when needed
#52 Enlarge the grid size and reduce the tile size when a larger complexity is needed to lower the frame rate. Refactor the spiral iterator into a separate class. Keep calling its next() method to move to the next cell. When its isDone() returns true enlarge the iterator grid size and resize the already created tiles to fit in the new grid size. Add a new class for the roundedRect tile called "Tile". This class can handle the location, size and animation of the Tile.
1 parent f1c7edb commit 3151355

File tree

2 files changed

+248
-95
lines changed

2 files changed

+248
-95
lines changed

MotionMark/resources/extensions.js

+26
Original file line numberDiff line numberDiff line change
@@ -265,18 +265,41 @@ Point = Utilities.createClass(
265265
return this.x;
266266
},
267267

268+
// Used when the point object is used as a size object.
269+
set width(w)
270+
{
271+
this.x = w;
272+
},
273+
268274
// Used when the point object is used as a size object.
269275
get height()
270276
{
271277
return this.y;
272278
},
273279

280+
// Used when the point object is used as a size object.
281+
set height(h)
282+
{
283+
this.y = h;
284+
},
285+
274286
// Used when the point object is used as a size object.
275287
get center()
276288
{
277289
return new Point(this.x / 2, this.y / 2);
278290
},
279291

292+
// Used when the point object is used as a size object.
293+
area: function() {
294+
return this.x * this.y;
295+
},
296+
297+
// Used when the point object is used as a size object.
298+
expand(width, height) {
299+
this.x += width;
300+
this.y += height;
301+
},
302+
280303
str: function()
281304
{
282305
return "x = " + this.x + ", y = " + this.y;
@@ -320,6 +343,9 @@ Point = Utilities.createClass(
320343
}
321344
});
322345

346+
// FIXME: Add a seprate class for Size.
347+
let Size = Point;
348+
323349
Utilities.extendObject(Point, {
324350
zero: new Point(0, 0),
325351

0 commit comments

Comments
 (0)