|
7 | 7 | <body>
|
8 | 8 |
|
9 | 9 | <div class="el" id="js-el"></div>
|
| 10 | + <div class="el2" id="js-el2"></div> |
| 11 | + <div class="shadow" id="js-shadow"></div> |
10 | 12 | <style>
|
11 | 13 | body, html {
|
12 | 14 | margin: 0;
|
|
18 | 20 | .el {
|
19 | 21 | position: absolute;
|
20 | 22 | left: 10%;
|
21 |
| - top: 50%; |
| 23 | + top: 80%; |
22 | 24 | width: 100px;
|
23 | 25 | height: 100px;
|
24 | 26 | margin-left: -50px;
|
25 | 27 | margin-top: -50px;
|
26 | 28 | background: #572B53;
|
27 | 29 | border-radius: 3px;
|
| 30 | + z-index: 1; |
| 31 | + } |
| 32 | + |
| 33 | + .el2 { |
| 34 | + position: absolute; |
| 35 | + left: 10%; |
| 36 | + top: 80%; |
| 37 | + width: 50px; |
| 38 | + height: 50px; |
| 39 | + margin-left: -25px; |
| 40 | + margin-top: -50px; |
| 41 | + background: #3A0839; |
| 42 | + background: #230323; |
| 43 | + /*background: #FF512F;*/ |
| 44 | + border-radius: 3px; |
| 45 | + z-index: 1; |
| 46 | + /*transform-origin: center bottom;*/ |
| 47 | + } |
| 48 | + |
| 49 | + .shadow { |
| 50 | + position: absolute; |
| 51 | + left: 10%; |
| 52 | + top: 80%; |
| 53 | + width: 80px; |
| 54 | + height: 7px; |
| 55 | + margin-left: -40px; |
| 56 | + margin-top: 45px; |
| 57 | + background: #333; |
| 58 | + opacity: .25; |
| 59 | + border-radius: 50%; |
| 60 | + z-index: 0; |
| 61 | + /*transform-origin: center bottom;*/ |
28 | 62 | }
|
29 | 63 | </style>
|
30 | 64 |
|
|
34 | 68 |
|
35 | 69 | <script>
|
36 | 70 |
|
37 |
| - var scaleCurve = new window.MojsCurveEditor({ name: 'curve_scale', isSaveState: true }); |
38 |
| - |
39 |
| - var curveEditor = new window.MojsCurveEditor({ name: 'curve1', isSaveState: true }); |
40 |
| - |
41 |
| - var html = new mojs.Html({ |
42 |
| - el: '#js-el', |
43 |
| - y: { [-200] : -200, curve: curveEditor.getEasing() }, |
44 |
| - scaleX: { 2:2, curve: scaleCurve.getEasing() } |
45 |
| - }); |
| 71 | + new MojsCurveEditor({ name: 'some name' }); |
46 | 72 |
|
47 |
| - new MojsPlayer({ add: html }); |
48 |
| - // scaleX/scaleY : M0, 0 C0.6729540169506724, -28.101525445522107 13.041331697335014, -94.89847455447803 40, -95 C74.3872397312364, -94.81581115980767 71.04133169733501, 0.10152544552201628 100, 0 |
49 |
| - // originY : M0, 0 C4.324651237095854, -97.09389091882751 -12.269098738159038, -100.52241754574061 40, -100 C69.70027963716932, -99.70315257828365 75, -100 75, -100 C75, -100 77.18670774544789, -105.94552943119928 80, 0 C93.51535255761112, -0.007114543223372127 100, 0 100, 0 |
50 |
| - // var curveEditor = new window.MojsCurveEditor({ name: 'curve1', isSaveState: true }); |
51 |
| - // var curveEditor2 = new window.MojsCurveEditor({ name: 'curve2', isSaveState: true }); |
| 73 | + // var scaleCurve = new window.MojsCurveEditor({ name: 'curve_scale' }); |
| 74 | + // var rotateCurve = new window.MojsCurveEditor({ name: 'curve_rotate' }); |
| 75 | + // var originCurve = new window.MojsCurveEditor({ name: 'curve_origin' }); |
| 76 | + // var curveEditor = new window.MojsCurveEditor({ name: 'curve1' }); |
| 77 | + // var curveEditorSmall = new window.MojsCurveEditor({ name: 'curve1_small' }); |
52 | 78 |
|
53 | 79 | // var CUSTOM_PROPS = {
|
54 |
| - // originY: { |
55 |
| - // type: 'unit', |
56 |
| - // default: '50%' |
57 |
| - // }, |
| 80 | + // originY: 50, |
58 | 81 | // draw (el, props) {
|
59 |
| - // // console.log(props.y); |
60 |
| - // el.style.transformOrigin = `50% ${props.originY}`; |
| 82 | + // el.style.transformOrigin = `50% ${props.originY}%`; |
61 | 83 | // }
|
62 | 84 | // }
|
63 | 85 |
|
64 |
| - // var duration = 500, |
65 |
| - // shift = 150; |
| 86 | + // var CUSTOM_PROPS_2 = { |
| 87 | + // originY: 50, |
| 88 | + // draw (el, props) { |
| 89 | + // el.style.transformOrigin = `50% ${props.originY}%`; |
| 90 | + // } |
| 91 | + // } |
| 92 | + |
| 93 | + // const timeline = new mojs.Timeline(); |
66 | 94 |
|
67 | 95 | // var html = new mojs.Html({
|
68 | 96 | // el: '#js-el',
|
69 |
| - // y: { [-shift]: 0, easing: 'cubic.in', duration }, |
70 |
| - // rotateZ: { [-90]: 0, easing: 'linear.none', duration }, |
71 |
| - // originY: '50%', |
72 |
| - // customProperties: CUSTOM_PROPS |
73 |
| - // // transformOrigin: '50% 50%' |
74 |
| - // }) |
75 |
| - // .then({ |
76 |
| - // scaleX: { |
77 |
| - // 1: 1, |
78 |
| - // curve: curveEditor.getEasing(), |
79 |
| - // duration: duration |
80 |
| - // }, |
| 97 | + // customProperties: CUSTOM_PROPS, |
| 98 | + // duration: 1000, |
| 99 | + // y: { [-200] : -200, curve: curveEditor.getEasing() }, |
| 100 | + // scaleX: { 1:1, curve: scaleCurve.getEasing() }, |
81 | 101 | // scaleY: {
|
82 |
| - // 1: 1, |
83 |
| - // curve: curveEditor.getEasing({ transform: (k) => { return 1 + ( 1-k )/1.5; } }), |
84 |
| - // duration: duration |
| 102 | + // 1:1, |
| 103 | + // curve: scaleCurve.getEasing({ |
| 104 | + // transform: (k) => { return 1 + ( 1-k )/1.5; } |
| 105 | + // }) |
85 | 106 | // },
|
86 |
| - // originY: { '50%': '50%', curve: curveEditor2.getEasing(), duration }, |
87 |
| - // y: { to: -shift, easing: 'cubic.out', delay: .75*duration, duration }, |
88 |
| - // rotateZ: { 0: 90, delay: .75*duration, easing: 'linear.none', duration }, |
89 |
| - // }) |
90 |
| - |
91 |
| - // var player = new MojsPlayer({ add: html }); |
92 |
| - |
93 |
| - </script> |
| 107 | + // angleZ: { 90: 90, curve: rotateCurve.getEasing() }, |
| 108 | + // originY: { 100: 100, curve: originCurve.getEasing() } |
| 109 | + // }); |
94 | 110 |
|
95 |
| - <script> |
96 |
| - // var curveEditor = new window.MojsCurveEditor({ |
97 |
| - // name: 'curve_1', isSaveState: true }); |
98 |
| - // var curveEditor2 = new window.MojsCurveEditor({ name: 'curve_2', isSaveState: true }); |
99 |
| - // var curveEditor3 = new window.MojsCurveEditor({ name: 'curve_3', isSaveState: true }); |
100 |
| - // var curveEditor4 = new window.MojsCurveEditor({ name: 'curve_4', isSaveState: true }); |
| 111 | + // var html2 = new mojs.Html({ |
| 112 | + // el: '#js-el2', |
| 113 | + // customProperties: CUSTOM_PROPS_2, |
| 114 | + // duration: 1000, |
| 115 | + // y: { [-300] : -300, curve: curveEditorSmall.getEasing() }, |
| 116 | + // scaleX: { 1:1, curve: scaleCurve.getEasing() }, |
| 117 | + // scaleY: { |
| 118 | + // 1:1, |
| 119 | + // curve: scaleCurve.getEasing({ |
| 120 | + // transform: (k) => { return 1 + ( 1-k )/1.5; } |
| 121 | + // }) |
| 122 | + // }, |
| 123 | + // angleZ: { [-90]: -90, curve: rotateCurve.getEasing() }, |
| 124 | + // originY: { 100: 100, curve: originCurve.getEasing() } |
| 125 | + // }); |
101 | 126 |
|
102 |
| - // var CUSTOM_PROPS = { |
103 |
| - // originY: { |
104 |
| - // type: 'unit', |
105 |
| - // default: '50%' |
106 |
| - // }, |
107 |
| - // draw (el, props) { |
108 |
| - // el.style.transformOrigin = `50% ${props.originY}`; |
109 |
| - // } |
| 127 | + // const colors = [ '#7b7b7b', '#6b6b6b', '#5b5b5b', '#4A4A4A' ]; |
| 128 | + |
| 129 | + // const burst = new mojs.Burst({ |
| 130 | + // // parent: '#js-el', |
| 131 | + // isShowStart: true, |
| 132 | + // degree: 10, |
| 133 | + // count: 5, |
| 134 | + // angle: {90: 10, easing: 'cubic.inout'}, |
| 135 | + // left: '10%', |
| 136 | + // top: '90%', |
| 137 | + // x: { 0: 150, easing: 'cubic.in' }, |
| 138 | + // // scale: { 0: 1, easing: 'expo.out' }, |
| 139 | + // y: -5, |
| 140 | + // radius: {0:150}, |
| 141 | + // timeline: { speed: .75 }, |
| 142 | + // opacity: .65, |
| 143 | + // children: { |
| 144 | + // // fill: '#222', |
| 145 | + // fill: colors, |
| 146 | + // radius: 'rand(12,18)', |
| 147 | + // isSwirl: true, |
| 148 | + // direction: 1, |
| 149 | + // pathScale: 'rand(.5, .75)', |
| 150 | + // swirlFrequency: 'rand(2, 4)', |
| 151 | + // swirlSize: 'rand(10, 17)', |
| 152 | + // scale: { 1: 0, easing: 'cubic.inout' }, |
| 153 | + // // delay: 'rand(300, 350)', |
| 154 | + // delay: 235, |
| 155 | + // // duration: 'rand(300, 500)' |
| 156 | + // duration: 'stagger(300, 35)' |
110 | 157 | // }
|
| 158 | + // }); |
111 | 159 |
|
112 |
| - // var duration = 1300, |
113 |
| - // shift = 200; |
| 160 | + // const burst2 = new mojs.Burst({ |
| 161 | + // // parent: '#js-el', |
| 162 | + // isShowStart: true, |
| 163 | + // degree: 10, |
| 164 | + // count: 5, |
| 165 | + // angle: {[-90]: -10, easing: 'cubic.inout'}, |
| 166 | + // left: '10%', |
| 167 | + // top: '90%', |
| 168 | + // x: { 0: -150, easing: 'cubic.in' }, |
| 169 | + // // scale: { 0: 1, easing: 'expo.out' }, |
| 170 | + // y: -5, |
| 171 | + // radius: {0:150}, |
| 172 | + // timeline: { speed: .75 }, |
| 173 | + // opacity: .65, |
| 174 | + // children: { |
| 175 | + // // fill: '#222', |
| 176 | + // fill: colors, |
| 177 | + // radius: 'rand(12,18)', |
| 178 | + // isSwirl: true, |
| 179 | + // direction: 1, |
| 180 | + // pathScale: 'rand(.5, .75)', |
| 181 | + // swirlFrequency: 'rand(2, 4)', |
| 182 | + // swirlSize: 'rand(10, 17)', |
| 183 | + // scale: { 1: 0, easing: 'cubic.inout' }, |
| 184 | + // // delay: 'rand(300, 350)', |
| 185 | + // delay: 235, |
| 186 | + // // duration: 'rand(300, 500)' |
| 187 | + // duration: 'stagger(300, 35)' |
| 188 | + // } |
| 189 | + // }); |
114 | 190 |
|
115 |
| - // var scaleXEasing = mojs.easing.path('M0, 0 C0, 0 20.587826704563234, 0.2556510416340589 30, 0 C36.26931615257986, -88.2556510416341 42.626912355168805, -90.00829536701315 50, -90 C67.23156561545866, -87.42027606155817 62.11908815856753, -13.0664841947621 82.61682242990655, 0 C90.11322158776092, 0.49505562333352426 100, 0 100, 0 '), |
116 |
| - // scaleYEasing = function (k) { return 1 + ( 1 - scaleXEasing(k) )/1.25 }; |
| 191 | + // burst.el.style.zIndex = 3; |
| 192 | + // burst2.el.style.zIndex = 3; |
117 | 193 |
|
118 |
| - // var html = new mojs.Html({ |
119 |
| - // el: '#js-el', |
120 |
| - // timeline: { |
121 |
| - // repeat: 10 |
122 |
| - // }, |
123 |
| - // // transformOrigin: '50% 100%', |
124 |
| - // y: { [-shift]: -shift, curve: curveEditor.getEasing(), duration }, |
125 |
| - // z: 0, |
126 |
| - // // y: { [-shift]: -shift, curve: 'M0, 0 C0, 0 5, 0 5, 0 C5, 0 27.204891108505585, 17.714285714285666 30, 100 C32.57142857142857, 100 68.93670267546892, 100.20610272857023 72.29729729729729, 100 C77.4927981877672, 32.65104012857265 95, 0 95, 0 C95, 0 100, 0 100, 0 ', duration }, |
127 |
| - // scaleX: { 1: 1, curve: scaleXEasing, duration }, |
128 |
| - // scaleY: { 1: 1, curve: scaleYEasing, duration }, |
129 |
| - // rotateZ: { [-90]: -90, curve: 'M0, 0 C0, 0 27.900763358778626, 100 27.900763358778626, 100 C27.900763358778626, 100 75, 100 75, 100 C75, 100 100, 200 100, 200 ', duration }, |
130 |
| - // originY: { '100%': '100%', curve: curveEditor4.getEasing(), duration }, |
131 |
| - // // originY: { '100%': '100%', curve: 'M0, 50 C0, 50 27, 50 27, 50 C27, 50 28, 0 28, 0 C28, 0 75, 0 75, 0 C75, 0 80, 50 80, 50 C80, 50 100, 50 100, 50 ', duration }, |
132 |
| - |
133 |
| - // customProperties: CUSTOM_PROPS |
| 194 | + // var shadow = new mojs.Html({ |
| 195 | + // el: '#js-shadow', |
| 196 | + // duration: 1000, |
| 197 | + // opacity: { 1: 1, curve: scaleCurve.getEasing({ |
| 198 | + // transform: (k) => { |
| 199 | + // return Math.max((k - 1)/4, .05); |
| 200 | + // } |
| 201 | + // }) }, |
| 202 | + // scale: { 1:1, curve: scaleCurve.getEasing({ |
| 203 | + // transform: (k) => { return 1.35*k; } |
| 204 | + // })} |
134 | 205 | // });
|
135 | 206 |
|
136 |
| - // // html.play(); |
137 |
| - |
138 |
| - // var player = new MojsPlayer({ add: html }); |
| 207 | + // timeline.add(html, html2, burst, burst2, shadow); |
| 208 | + |
| 209 | + // new MojsPlayer({ add: timeline }); |
139 | 210 |
|
140 | 211 | </script>
|
141 | 212 |
|
|
0 commit comments