Skip to content

Commit 25a5449

Browse files
committed
Convert TemplateCanvasObject to JS class syntax.
1 parent fedf448 commit 25a5449

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

MotionMark/tests/template/resources/template-canvas.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,24 @@
2323
* THE POSSIBILITY OF SUCH DAMAGE.
2424
*/
2525

26-
function TemplateCanvasObject(stage)
26+
class TemplateCanvasObject
2727
{
28+
constructor(stage)
29+
{
30+
super(stage);
31+
}
32+
2833
// For the canvas stage, most likely you will need to create your
2934
// animated object since it's only draw time thing.
3035

3136
// Fill in your object data.
32-
}
33-
34-
TemplateCanvasObject.prototype = {
35-
_draw: function()
37+
38+
_draw()
3639
{
3740
// Draw your object.
38-
},
41+
}
3942

40-
animate: function(timeDelta)
43+
animate(timeDelta)
4144
{
4245
// Redraw the animated object. The last time this animated
4346
// item was drawn before 'timeDelta'.
@@ -47,7 +50,7 @@ TemplateCanvasObject.prototype = {
4750
// Redraw your object.
4851
this._draw();
4952
}
50-
};
53+
}
5154

5255
class TemplateCanvasStage extends Stage {
5356
constructor()

0 commit comments

Comments
 (0)