MCPcopy Create free account
hub / github.com/alienkitty/space.js / css

Method css

src/utils/Interface.js:145–270  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

143 }
144
145 css(props) {
146 if (!this.element) {
147 return;
148 }
149
150 const style = this.style;
151
152 for (const key in props) {
153 if (~Transforms.indexOf(key)) {
154 style[key] = props[key];
155 this.isTransform = true;
156 continue;
157 }
158
159 if (~Filters.indexOf(key)) {
160 style[key] = props[key];
161 this.isFilter = true;
162 continue;
163 }
164
165 let val;
166
167 if (~Numeric.indexOf(key)) {
168 val = props[key];
169 style[key] = val;
170 } else {
171 val = typeof props[key] !== 'string' ? props[key] + 'px' : props[key];
172 }
173
174 this.element.style[key] = val;
175 }
176
177 if (this.isTransform) {
178 let transform = '';
179
180 if (style.x !== undefined || style.y !== undefined || style.z !== undefined) {
181 const x = style.x !== undefined ? style.x : 0;
182 const y = style.y !== undefined ? style.y : 0;
183 const z = style.z !== undefined ? style.z : 0;
184
185 transform += `translate3d(${x}px, ${y}px, ${z}px)`;
186 }
187
188 if (style.skewX !== undefined) {
189 transform += `skewX(${style.skewX}deg)`;
190 }
191
192 if (style.skewY !== undefined) {
193 transform += `skewY(${style.skewY}deg)`;
194 }
195
196 if (style.rotation !== undefined) {
197 transform += `rotate(${style.rotation}deg)`;
198 }
199
200 if (style.rotationX !== undefined) {
201 transform += `rotateX(${style.rotationX}deg)`;
202 }

Callers 15

hideMethod · 0.95
showMethod · 0.95
invisibleMethod · 0.95
visibleMethod · 0.95
drawLineMethod · 0.95
tweenMethod · 0.95
initColorRingMethod · 0.95
createGradientMethod · 0.95
initTextMethod · 0.95
initTextMethod · 0.95
initTextMethod · 0.95
initCanvasMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected