@6edesign/svelte-three
Version:
[Demo](https://6edesign.github.io/svelte-three-mograph/)
113 lines (98 loc) • 3.08 kB
JavaScript
/* src/components/primitives/Torus.svelte generated by Svelte v3.31.2 */
import {
SvelteComponent,
assign,
create_component,
destroy_component,
exclude_internal_props,
get_spread_object,
get_spread_update,
init,
mount_component,
safe_not_equal,
transition_in,
transition_out
} from "../../../web_modules/svelte/internal.js";
import { TorusBufferGeometry } from "../../../web_modules/three.js";
import Primitive from "./Primitive.js";
function create_fragment(ctx) {
let primitive;
let current;
const primitive_spread_levels = [
{ Geometry: TorusBufferGeometry },
/*$$props*/ ctx[1],
{ size: /*size*/ ctx[0] }
];
let primitive_props = {};
for (let i = 0; i < primitive_spread_levels.length; i += 1) {
primitive_props = assign(primitive_props, primitive_spread_levels[i]);
}
primitive = new Primitive({ props: primitive_props });
return {
c() {
create_component(primitive.$$.fragment);
},
m(target, anchor) {
mount_component(primitive, target, anchor);
current = true;
},
p(ctx, [dirty]) {
const primitive_changes = (dirty & /*TorusBufferGeometry, $$props, size*/ 3)
? get_spread_update(primitive_spread_levels, [
dirty & /*TorusBufferGeometry*/ 0 && { Geometry: TorusBufferGeometry },
dirty & /*$$props*/ 2 && get_spread_object(/*$$props*/ ctx[1]),
dirty & /*size*/ 1 && { size: /*size*/ ctx[0] }
])
: {};
primitive.$set(primitive_changes);
},
i(local) {
if (current) return;
transition_in(primitive.$$.fragment, local);
current = true;
},
o(local) {
transition_out(primitive.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(primitive, detaching);
}
};
}
function instance($$self, $$props, $$invalidate) {
let size;
let { radius = 1 } = $$props;
let { tube = 0.4 } = $$props;
let { radialSegments = 6 } = $$props;
let { tubularSegments = 6 } = $$props;
let { arc = Math.PI * 2 } = $$props;
$$self.$$set = $$new_props => {
$$invalidate(1, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props)));
if ("radius" in $$new_props) $$invalidate(2, radius = $$new_props.radius);
if ("tube" in $$new_props) $$invalidate(3, tube = $$new_props.tube);
if ("radialSegments" in $$new_props) $$invalidate(4, radialSegments = $$new_props.radialSegments);
if ("tubularSegments" in $$new_props) $$invalidate(5, tubularSegments = $$new_props.tubularSegments);
if ("arc" in $$new_props) $$invalidate(6, arc = $$new_props.arc);
};
$$self.$$.update = () => {
if ($$self.$$.dirty & /*radius, tube, radialSegments, tubularSegments, arc*/ 124) {
$: $$invalidate(0, size = [radius, tube, radialSegments, tubularSegments, arc]);
}
};
$$props = exclude_internal_props($$props);
return [size, $$props, radius, tube, radialSegments, tubularSegments, arc];
}
class Torus extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, {
radius: 2,
tube: 3,
radialSegments: 4,
tubularSegments: 5,
arc: 6
});
}
}
export default Torus;