immaterial-design-ripple
Version:
HTML5 Canvas based pixelated ripple effect
1,223 lines (1,222 loc) • 731 kB
JSON
{
"type": "Program",
"body": [
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"local": {
"type": "Identifier",
"name": "EventEmitter",
"range": [
7,
19
],
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 19
}
}
},
"range": [
7,
19
],
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 19
}
}
}
],
"source": {
"type": "Literal",
"value": "events",
"raw": "'events'",
"range": [
25,
33
],
"loc": {
"start": {
"line": 1,
"column": 25
},
"end": {
"line": 1,
"column": 33
}
}
},
"range": [
0,
34
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 34
}
}
},
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"local": {
"type": "Identifier",
"name": "Promise",
"range": [
42,
49
],
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 14
}
}
},
"range": [
42,
49
],
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 14
}
}
}
],
"source": {
"type": "Literal",
"value": "bluebird",
"raw": "'bluebird'",
"range": [
55,
65
],
"loc": {
"start": {
"line": 2,
"column": 20
},
"end": {
"line": 2,
"column": 30
}
}
},
"range": [
35,
66
],
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 31
}
}
},
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportNamespaceSpecifier",
"local": {
"type": "Identifier",
"name": "util",
"range": [
79,
83
],
"loc": {
"start": {
"line": 3,
"column": 12
},
"end": {
"line": 3,
"column": 16
}
}
},
"range": [
74,
83
],
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 16
}
}
}
],
"source": {
"type": "Literal",
"value": "./utility",
"raw": "'./utility'",
"range": [
89,
100
],
"loc": {
"start": {
"line": 3,
"column": 22
},
"end": {
"line": 3,
"column": 33
}
}
},
"range": [
67,
101
],
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 34
}
}
},
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"local": {
"type": "Identifier",
"name": "JSON5",
"range": [
110,
115
],
"loc": {
"start": {
"line": 5,
"column": 7
},
"end": {
"line": 5,
"column": 12
}
}
},
"range": [
110,
115
],
"loc": {
"start": {
"line": 5,
"column": 7
},
"end": {
"line": 5,
"column": 12
}
}
}
],
"source": {
"type": "Literal",
"value": "json5",
"raw": "'json5'",
"range": [
121,
128
],
"loc": {
"start": {
"line": 5,
"column": 18
},
"end": {
"line": 5,
"column": 25
}
}
},
"range": [
103,
129
],
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 5,
"column": 26
}
}
},
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"local": {
"type": "Identifier",
"name": "objectAssign",
"range": [
137,
149
],
"loc": {
"start": {
"line": 6,
"column": 7
},
"end": {
"line": 6,
"column": 19
}
}
},
"range": [
137,
149
],
"loc": {
"start": {
"line": 6,
"column": 7
},
"end": {
"line": 6,
"column": 19
}
}
}
],
"source": {
"type": "Literal",
"value": "object-assign",
"raw": "'object-assign'",
"range": [
155,
170
],
"loc": {
"start": {
"line": 6,
"column": 25
},
"end": {
"line": 6,
"column": 40
}
}
},
"range": [
130,
171
],
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 6,
"column": 41
}
}
},
{
"type": "ExportDefaultDeclaration",
"declaration": {
"type": "ClassDeclaration",
"id": {
"type": "Identifier",
"name": "ImdRipple",
"range": [
194,
203
],
"loc": {
"start": {
"line": 8,
"column": 21
},
"end": {
"line": 8,
"column": 30
}
}
},
"superClass": {
"type": "Identifier",
"name": "EventEmitter",
"range": [
212,
224
],
"loc": {
"start": {
"line": 8,
"column": 39
},
"end": {
"line": 8,
"column": 51
}
}
},
"body": {
"type": "ClassBody",
"body": [
{
"type": "MethodDefinition",
"key": {
"type": "Identifier",
"name": "util",
"range": [
338,
342
],
"loc": {
"start": {
"line": 16,
"column": 13
},
"end": {
"line": 16,
"column": 17
}
}
},
"value": {
"type": "FunctionExpression",
"id": null,
"params": [],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ReturnStatement",
"argument": {
"type": "Identifier",
"name": "util",
"range": [
358,
362
],
"loc": {
"start": {
"line": 17,
"column": 11
},
"end": {
"line": 17,
"column": 15
}
}
},
"range": [
351,
363
],
"loc": {
"start": {
"line": 17,
"column": 4
},
"end": {
"line": 17,
"column": 16
}
}
}
],
"range": [
345,
367
],
"loc": {
"start": {
"line": 16,
"column": 20
},
"end": {
"line": 18,
"column": 3
}
}
},
"generator": false,
"expression": false,
"range": [
342,
367
],
"loc": {
"start": {
"line": 16,
"column": 17
},
"end": {
"line": 18,
"column": 3
}
}
},
"kind": "get",
"computed": false,
"range": [
327,
367
],
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 18,
"column": 3
}
},
"leadingComments": [
{
"type": "Block",
"value": "*\n * アニメーションで使用するユーティリティ関数群の参照\n *\n * @static\n * @public\n * @property ImdRipple.util\n ",
"range": [
229,
324
],
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 15,
"column": 4
}
}
}
],
"trailingComments": [
{
"type": "Block",
"value": "*\n * ページの読み込み時にインスタンスを自動で生成する\n *\n * @static\n * @public\n * @method ImdRipple.bindOnLoad\n ",
"range": [
371,
469
],
"loc": {
"start": {
"line": 20,
"column": 2
},
"end": {
"line": 26,
"column": 4
}
}
}
],
"static": true
},
{
"type": "MethodDefinition",
"key": {
"type": "Identifier",
"name": "bindOnLoad",
"range": [
479,
489
],
"loc": {
"start": {
"line": 27,
"column": 9
},
"end": {
"line": 27,
"column": 19
}
}
},
"value": {
"type": "FunctionExpression",
"id": null,
"params": [
{
"type": "Identifier",
"name": "selector",
"range": [
490,
498
],
"loc": {
"start": {
"line": 27,
"column": 20
},
"end": {
"line": 27,
"column": 28
}
}
},
{
"type": "AssignmentPattern",
"left": {
"type": "Identifier",
"name": "options",
"range": [
500,
507
],
"loc": {
"start": {
"line": 27,
"column": 30
},
"end": {
"line": 27,
"column": 37
}
}
},
"right": {
"type": "ObjectExpression",
"properties": [],
"range": [
510,
512
],
"loc": {
"start": {
"line": 27,
"column": 40
},
"end": {
"line": 27,
"column": 42
}
}
},
"range": [
500,
512
],
"loc": {
"start": {
"line": 27,
"column": 30
},
"end": {
"line": 27,
"column": 42
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ReturnStatement",
"argument": {
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "Promise",
"range": [
531,
538
],
"loc": {
"start": {
"line": 28,
"column": 15
},
"end": {
"line": 28,
"column": 22
}
}
},
"arguments": [
{
"type": "ArrowFunctionExpression",
"id": null,
"params": [
{
"type": "Identifier",
"name": "resolve",
"range": [
540,
547
],
"loc": {
"start": {
"line": 28,
"column": 24
},
"end": {
"line": 28,
"column": 31
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "window",
"range": [
560,
566
],
"loc": {
"start": {
"line": 29,
"column": 6
},
"end": {
"line": 29,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"name": "addEventListener",
"range": [
567,
583
],
"loc": {
"start": {
"line": 29,
"column": 13
},
"end": {
"line": 29,
"column": 29
}
}
},
"range": [
560,
583
],
"loc": {
"start": {
"line": 29,
"column": 6
},
"end": {
"line": 29,
"column": 29
}
}
},
"arguments": [
{
"type": "Literal",
"value": "load",
"raw": "'load'",
"range": [
584,
590
],
"loc": {
"start": {
"line": 29,
"column": 30
},
"end": {
"line": 29,
"column": 36
}
}
},
{
"type": "ArrowFunctionExpression",
"id": null,
"params": [],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "VariableDeclaration",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "elements",
"range": [
614,
622
],
"loc": {
"start": {
"line": 30,
"column": 14
},
"end": {
"line": 30,
"column": 22
}
}
},
"init": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ArrayExpression",
"elements": [],
"range": [
625,
627
],
"loc": {
"start": {
"line": 30,
"column": 25
},
"end": {
"line": 30,
"column": 27
}
}
},
"property": {
"type": "Identifier",
"name": "slice",
"range": [
628,
633
],
"loc": {
"start": {
"line": 30,
"column": 28
},
"end": {
"line": 30,
"column": 33
}
}
},
"range": [
625,
633
],
"loc": {
"start": {
"line": 30,
"column": 25
},
"end": {
"line": 30,
"column": 33
}
}
},
"property": {
"type": "Identifier",
"name": "call",
"range": [
634,
638
],
"loc": {
"start": {
"line": 30,
"column": 34
},
"end": {
"line": 30,
"column": 38
}
}
},
"range": [
625,
638
],
"loc": {
"start": {
"line": 30,
"column": 25
},
"end": {
"line": 30,
"column": 38
}
}
},
"arguments": [
{
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "document",
"range": [
639,
647
],
"loc": {
"start": {
"line": 30,
"column": 39
},
"end": {
"line": 30,
"column": 47
}
}
},
"property": {
"type": "Identifier",
"name": "querySelectorAll",
"range": [
648,
664
],
"loc": {
"start": {
"line": 30,
"column": 48
},
"end": {
"line": 30,
"column": 64
}
}
},
"range": [
639,
664
],
"loc": {
"start": {
"line": 30,
"column": 39
},
"end": {
"line": 30,
"column": 64
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "selector",
"range": [
665,
673
],
"loc": {
"start": {
"line": 30,
"column": 65
},
"end": {
"line": 30,
"column": 73
}
}
}
],
"range": [
639,
674
],
"loc": {
"start": {
"line": 30,
"column": 39
},
"end": {
"line": 30,
"column": 74
}
}
}
],
"range": [
625,
675
],
"loc": {
"start": {
"line": 30,
"column": 25
},
"end": {
"line": 30,
"column": 75
}
}
},
"range": [
614,
675
],
"loc": {
"start": {
"line": 30,
"column": 14
},
"end": {
"line": 30,
"column": 75
}
}
}
],
"kind": "const",
"range": [
608,
676
],
"loc": {
"start": {
"line": 30,
"column": 8
},
"end": {
"line": 30,
"column": 76
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "CallExpression",
"callee": {
"type": "Identifier",
"name": "resolve",
"range": [
686,
693
],
"loc": {
"start": {
"line": 32,
"column": 8
},
"end": {
"line": 32,
"column": 15
}
}
},
"arguments": [
{
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "elements",
"range": [
694,
702
],
"loc": {
"start": {
"line": 32,
"column": 16
},
"end": {
"line": 32,
"column": 24
}
}
},
"property": {
"type": "Identifier",
"name": "map",
"range": [
703,
706
],
"loc": {
"start": {
"line": 32,
"column": 25
},
"end": {
"line": 32,
"column": 28
}
}
},
"range": [
694,
706
],
"loc": {
"start": {
"line": 32,
"column": 16
},
"end": {
"line": 32,
"column": 28
}
}
},
"arguments": [
{
"type": "ArrowFunctionExpression",
"id": null,
"params": [
{
"type": "Identifier",
"name": "element",
"range": [
708,
715
],
"loc": {
"start": {
"line": 32,
"column": 30
},
"end": {
"line": 32,
"column": 37
}
}
}
],
"body": {
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "ImdRipple",
"range": [
724,
733
],
"loc": {
"start": {
"line": 32,
"column": 46
},
"end": {
"line": 32,
"column": 55
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "element",
"range": [
734,
741
],
"loc": {
"start": {
"line": 32,
"column": 56
},
"end": {
"line": 32,
"column": 63
}
}
},
{
"type": "Identifier",
"name": "options",
"range": [
743,
750
],
"loc": {
"start": {
"line": 32,
"column": 65
},
"end": {
"line": 32,
"column": 72
}
}
}
],
"range": [
720,
751
],
"loc": {
"start": {
"line": 32,
"column": 42
},