Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: bower_components/web-animations-js/test/testcases/manual-test-step.html

Issue 786953007: npm_modules: Fork bower_components into Polymer 0.4.0 and 0.5.0 versions (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!--
2 Copyright 2012 Google Inc. All Rights Reserved.
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 -->
16
17 <!DOCTYPE html><meta charset="UTF-8">
18 <style>
19 canvas {
20 border: silver solid 1px;
21 padding: 5px;
22 }
23 span {
24 display: inline-block;
25 padding: 5px;
26 }
27 </style>
28 <body>
29
30 <script src="../../web-animations.js"></script>
31 <script>
32 "use strict";
33
34 var size = 100;
35 var duration = 3.0 * 1000;
36
37 function testStep(numSteps, position) {
38 var canvas = document.createElement('canvas');
39 canvas.width = canvas.height = size;
40 var ctx = canvas.getContext('2d');
41 ctx.beginPath();
42 var span = document.createElement('span');
43 span.appendChild(canvas);
44 span.appendChild(document.createElement('br'));
45 span.appendChild(document.createTextNode('steps: ' + numSteps));
46 span.appendChild(document.createElement('br'));
47 span.appendChild(document.createTextNode('position: ' + position));
48 document.body.appendChild(span);
49 return new Animation(ctx,
50 function(timeFraction, animation) {
51 var target = animation.target;
52 var inputTimeFraction = player.currentTime / duration;
53 if (target.lastTimeFraction !== timeFraction) {
54 target.beginPath();
55 target.moveTo(inputTimeFraction * size,
56 size - target.lastTimeFraction * size);
57 target.lineTo(inputTimeFraction * size, size - timeFraction * size);
58 target.strokeStyle = 'silver';
59 target.stroke();
60 target.beginPath();
61 target.strokeStyle = 'blue';
62 } else {
63 target.lineTo(inputTimeFraction * size, size - timeFraction * size);
64 }
65 target.lastTimeFraction = timeFraction;
66 target.stroke();
67 }, {
68 duration: duration,
69 easing: 'steps(' + numSteps + ', ' + position + ')',
70 });
71 }
72
73 // TODO: Making player global like this is is rather ugly. It would be nice if
74 // the animation or player were passed to the custom animation effect's sample
75 // function.
76 var player = document.timeline.play(new AnimationGroup([
77 testStep(1, 'start'),
78 testStep(1, 'middle'),
79 testStep(1, 'end'),
80 testStep(3, 'start'),
81 testStep(3, 'middle'),
82 testStep(3, 'end'),
83 testStep(10, 'start'),
84 testStep(10, 'middle'),
85 testStep(10, 'end'),
86 ]));
87
88 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698