1 | /*
|
2 | Copyright 2013-2015 ASIAL CORPORATION
|
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 |
|
18 | import util from './util.js';
|
19 |
|
20 | export default class BaseAnimator {
|
21 |
|
22 | /**
|
23 | * @param {Object} options
|
24 | * @param {String} options.timing
|
25 | * @param {Number} options.duration
|
26 | * @param {Number} options.delay
|
27 | */
|
28 | constructor(options = {}) {
|
29 | this.timing = options.timing || 'linear';
|
30 | this.duration = options.duration || 0;
|
31 | this.delay = options.delay || 0;
|
32 |
|
33 | this.def = {
|
34 | timing: this.timing,
|
35 | duration: this.duration,
|
36 | delay: this.delay
|
37 | };
|
38 | }
|
39 |
|
40 | static extend(properties = {}) {
|
41 | const extendedAnimator = this;
|
42 | const newAnimator = function() {
|
43 | extendedAnimator.apply(this, arguments);
|
44 | util.extend(this, properties);
|
45 | };
|
46 |
|
47 | newAnimator.prototype = this.prototype;
|
48 | return newAnimator;
|
49 | }
|
50 | }
|
51 |
|