MotionMark is a graphics benchmark that measures a browser’s capability to animate complex scenes at a target frame rate.
61 | 62 |More details about the benchmark are available. Bigger scores are better.
63 |For accurate results, please take your browser window full screen, or rotate your device to landscape orientation.
64 |Please rotate your device.
65 | 66 |67 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/MotionMark/tests/bouncing-particles/resources/bouncing-canvas-images.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015-2024 Apple Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions
6 | * are met:
7 | * 1. Redistributions of source code must retain the above copyright
8 | * notice, this list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright
10 | * notice, this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | *
13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 | * THE POSSIBILITY OF SUCH DAMAGE.
24 | */
25 |
26 | class BouncingCanvasImage extends BouncingCanvasParticle {
27 | constructor(stage)
28 | {
29 | super(stage, "image");
30 | this._imageElement = stage.imageElement;
31 | }
32 |
33 | _draw()
34 | {
35 | this.context.save();
36 | this.applyRotation();
37 | this.context.drawImage(this._imageElement, 0, 0, this.size.x, this.size.y);
38 | this.context.restore();
39 | }
40 | }
41 |
42 | class BouncingCanvasImagesStage extends BouncingCanvasParticlesStage {
43 | async initialize(benchmark, options)
44 | {
45 | await super.initialize(benchmark, options);
46 | const imageSrc = options["imageSrc"] || "../resources/yin-yang.svg";
47 | this.imageElement = document.querySelector(".hidden[src=\"" + imageSrc + "\"]");
48 | }
49 |
50 | createParticle()
51 | {
52 | return new BouncingCanvasImage(this);
53 | }
54 | }
55 |
56 | class BouncingCanvasImagesBenchmark extends Benchmark {
57 | constructor(options)
58 | {
59 | super(new BouncingCanvasImagesStage(), options);
60 | }
61 | }
62 |
63 | window.benchmarkClass = BouncingCanvasImagesBenchmark;
64 |
--------------------------------------------------------------------------------
/MotionMark/tests/template/resources/template-css.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015-0224 Apple Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions
6 | * are met:
7 | * 1. Redistributions of source code must retain the above copyright
8 | * notice, this list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright
10 | * notice, this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | *
13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 | * THE POSSIBILITY OF SUCH DAMAGE.
24 | */
25 |
26 | class TemplateCssStage extends Stage {
27 | async initialize(benchmark, options)
28 | {
29 | await super.initialize(benchmark, options);
30 | // Do initialization here.
31 | }
32 |
33 | tune(count)
34 | {
35 | // If count is -ve, -count elements need to be removed form the
36 | // stage. If count is +ve, +count elements need to be added to
37 | // the stage.
38 |
39 | // Change objects in the stage.
40 | }
41 |
42 | animate(timeDelta)
43 | {
44 | // Animate the elements such that all of them are redrawn. You
45 | // may need to define your object so it keeps its animation data.
46 | // This object should encapsulate a corrosponding HTMLElement.
47 | // You may also define a method called animate() in this object
48 | // and just call this function here for all the elements.
49 |
50 | // Loop through all your objects and ask them to animate.
51 | }
52 | }
53 |
54 | class TemplateCssBenchmark extends Benchmark {
55 | constructor(options)
56 | {
57 | super(new TemplateCssStage(), options);
58 | }
59 | }
60 |
61 | window.benchmarkClass = TemplateCssBenchmark;
62 |
--------------------------------------------------------------------------------
/MotionMark/tests/template/resources/template-svg.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015-2024 Apple Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions
6 | * are met:
7 | * 1. Redistributions of source code must retain the above copyright
8 | * notice, this list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright
10 | * notice, this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | *
13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 | * THE POSSIBILITY OF SUCH DAMAGE.
24 | */
25 |
26 | class TemplateSvgStage extends Stage {
27 | async initialize(benchmark, options)
28 | {
29 | await super.initialize(benchmark, options);
30 | // Do initialization here.
31 | }
32 |
33 | tune(count)
34 | {
35 | // If count is -ve, -count elements need to be removed form the
36 | // stage. If count is +ve, +count elements need to be added to
37 | // the stage.
38 |
39 | // TODO: Change objects in the stage.
40 | }
41 |
42 | animate(timeDelta)
43 | {
44 | // Animate the elements such that all of them are redrawn. You
45 | // may need to define your object so it keeps its animation data.
46 | // This object should encapsulate a corrosponding SVGElement.
47 | // You may also define a method called animate() in this object
48 | // and just call this function here for all the elements.
49 |
50 | // TODO: Loop through all your objects and ask them to animate.
51 | }
52 | }
53 |
54 | class TemplateSvgBenchmark extends Benchmark {
55 | constructor(options)
56 | {
57 | super(new TemplateSvgStage(), options);
58 | }
59 | }
60 |
61 | window.benchmarkClass = TemplateSvgBenchmark;
62 |
--------------------------------------------------------------------------------
/MotionMark/tests/simple/resources/simple-canvas.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions
6 | * are met:
7 | * 1. Redistributions of source code must retain the above copyright
8 | * notice, this list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright
10 | * notice, this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | *
13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 | * THE POSSIBILITY OF SUCH DAMAGE.
24 | */
25 |
26 | class SimpleCanvasStage extends CanvasStage {
27 | tune(count)
28 | {
29 | if (count == 0)
30 | return;
31 |
32 | if (count < 0) {
33 | this.offsetIndex = Math.max(this.offsetIndex + count, 0);
34 | return;
35 | }
36 |
37 | this.offsetIndex = this.offsetIndex + count;
38 | if (this.offsetIndex > this.objects.length) {
39 | // For some tests, it may be easier to see how well the test is going
40 | // by limiting the range of coordinates in which new objects can reside
41 | var coordinateMaximumFactor = Math.min(this.objects.length, Math.min(this.size.x, this.size.y)) / Math.min(this.size.x, this.size.y);
42 | var newIndex = this.offsetIndex - this.objects.length;
43 | for (var i = 0; i < newIndex; ++i)
44 | this.objects.push(new this._canvasObject(this, coordinateMaximumFactor));
45 | }
46 | }
47 |
48 | animate()
49 | {
50 | var context = this.context;
51 | context.clearRect(0, 0, this.size.x, this.size.y);
52 | for (var i = 0, length = this.offsetIndex; i < length; ++i)
53 | this.objects[i].draw(context);
54 | }
55 |
56 | complexity()
57 | {
58 | return this.offsetIndex;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/MotionMark/tests/core/multiply.html:
--------------------------------------------------------------------------------
1 |
25 |
26 |
27 |
28 |
29 |
30 |
66 |
67 |
68 |