Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Greenemeier committed Jan 13, 2021
2 parents fcf4fc8 + 534d80a commit 8409b4b
Show file tree
Hide file tree
Showing 19 changed files with 795 additions and 178 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [1.0.12](https://github.com/6eDesign/svelte-three-mograph/compare/v1.0.11...v1.0.12) (2021-01-13)


### Bug Fixes

* Update demo and add components: ([a2a9c58](https://github.com/6eDesign/svelte-three-mograph/commit/a2a9c58dd12fe19d76cbabfebcf995d40a2466d3))

## [1.0.11](https://github.com/6eDesign/svelte-three-mograph/compare/v1.0.10...v1.0.11) (2021-01-12)


Expand Down
224 changes: 148 additions & 76 deletions docs/_dist_/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import './App.css.proxy.js';
/* src/App.svelte generated by Svelte v3.31.2 */
import {
SvelteComponent,
add_flush_callback,
add_render_callback,
bind,
binding_callbacks,
check_outros,
create_component,
destroy_component,
Expand All @@ -22,32 +19,30 @@ import {
transition_out
} from "../web_modules/svelte/internal.js";

import { Scene, lights, mograph, primitives } from "./components/index.js";
import {
Scene,
Material,
numbers,
lights,
mograph,
primitives
} from "./components/index.js";

import OrbitExample from "./OrbitExample.js";

function create_if_block(ctx) {
let scene;
let updating_ctx;
let current;

function scene_ctx_binding(value) {
/*scene_ctx_binding*/ ctx[10].call(null, value);
}

let scene_props = {
background: "#000",
width: /*width*/ ctx[1],
height: /*height*/ ctx[2],
$$slots: { default: [create_default_slot] },
$$scope: { ctx }
};

if (/*sceneCtx*/ ctx[0] !== void 0) {
scene_props.ctx = /*sceneCtx*/ ctx[0];
}

scene = new Scene({ props: scene_props });
binding_callbacks.push(() => bind(scene, "ctx", scene_ctx_binding));
scene = new Scene({
props: {
background: "#000",
width: /*width*/ ctx[0],
height: /*height*/ ctx[1],
$$slots: { default: [create_default_slot] },
$$scope: { ctx }
}
});

return {
c() {
Expand All @@ -59,19 +54,13 @@ function create_if_block(ctx) {
},
p(ctx, dirty) {
const scene_changes = {};
if (dirty & /*width*/ 2) scene_changes.width = /*width*/ ctx[1];
if (dirty & /*height*/ 4) scene_changes.height = /*height*/ ctx[2];
if (dirty & /*width*/ 1) scene_changes.width = /*width*/ ctx[0];
if (dirty & /*height*/ 2) scene_changes.height = /*height*/ ctx[1];

if (dirty & /*$$scope, emitterPosition*/ 16392) {
if (dirty & /*$$scope*/ 65536) {
scene_changes.$$scope = { dirty, ctx };
}

if (!updating_ctx && dirty & /*sceneCtx*/ 1) {
updating_ctx = true;
scene_changes.ctx = /*sceneCtx*/ ctx[0];
add_flush_callback(() => updating_ctx = false);
}

scene.$set(scene_changes);
},
i(local) {
Expand All @@ -89,17 +78,16 @@ function create_if_block(ctx) {
};
}

// (28:4) <Emitter position={emitterPosition} size={[22, 3, 0.5]} direction={[0, 0, 2]} directionVariance={0.4} velocity={0.25} lifespan={3000} forces={[gravity]} particlesPerSecond={350} let:position let:rotation >
function create_default_slot_1(ctx) {
// (45:8) <Material roughness={1} metalness={0.1} {color}>
function create_default_slot_3(ctx) {
let icosahedron;
let current;

icosahedron = new /*Icosahedron*/ ctx[5]({
icosahedron = new /*Icosahedron*/ ctx[4]({
props: {
size: 0.13,
position: /*position*/ ctx[12],
rotation: /*rotation*/ ctx[13],
color: "#fff"
size: 0.1,
position: /*position*/ ctx[13],
rotation: /*rotation*/ ctx[14]
}
});

Expand All @@ -113,8 +101,8 @@ function create_default_slot_1(ctx) {
},
p(ctx, dirty) {
const icosahedron_changes = {};
if (dirty & /*position*/ 4096) icosahedron_changes.position = /*position*/ ctx[12];
if (dirty & /*rotation*/ 8192) icosahedron_changes.rotation = /*rotation*/ ctx[13];
if (dirty & /*position*/ 8192) icosahedron_changes.position = /*position*/ ctx[13];
if (dirty & /*rotation*/ 16384) icosahedron_changes.rotation = /*rotation*/ ctx[14];
icosahedron.$set(icosahedron_changes);
},
i(local) {
Expand All @@ -132,7 +120,105 @@ function create_default_slot_1(ctx) {
};
}

// (25:2) <Scene background="#000" {width} {height} bind:ctx={sceneCtx}>
// (44:6) <RandomColor let:color>
function create_default_slot_2(ctx) {
let material;
let current;

material = new Material({
props: {
roughness: 1,
metalness: 0.1,
color: /*color*/ ctx[15],
$$slots: { default: [create_default_slot_3] },
$$scope: { ctx }
}
});

return {
c() {
create_component(material.$$.fragment);
},
m(target, anchor) {
mount_component(material, target, anchor);
current = true;
},
p(ctx, dirty) {
const material_changes = {};
if (dirty & /*color*/ 32768) material_changes.color = /*color*/ ctx[15];

if (dirty & /*$$scope, position, rotation*/ 90112) {
material_changes.$$scope = { dirty, ctx };
}

material.$set(material_changes);
},
i(local) {
if (current) return;
transition_in(material.$$.fragment, local);
current = true;
},
o(local) {
transition_out(material.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(material, detaching);
}
};
}

// (32:4) <Emitter position={emitterPosition} size={[12, 3, 0.5]} direction={[0, 0, 2]} directionVariance={0.4} velocity={0.45} lifespan={3000} forces={[gravity]} particlesPerSecond={150} let:position let:rotation >
function create_default_slot_1(ctx) {
let randomcolor;
let current;

randomcolor = new /*RandomColor*/ ctx[2]({
props: {
$$slots: {
default: [
create_default_slot_2,
({ color }) => ({ 15: color }),
({ color }) => color ? 32768 : 0
]
},
$$scope: { ctx }
}
});

return {
c() {
create_component(randomcolor.$$.fragment);
},
m(target, anchor) {
mount_component(randomcolor, target, anchor);
current = true;
},
p(ctx, dirty) {
const randomcolor_changes = {};

if (dirty & /*$$scope, color, position, rotation*/ 122880) {
randomcolor_changes.$$scope = { dirty, ctx };
}

randomcolor.$set(randomcolor_changes);
},
i(local) {
if (current) return;
transition_in(randomcolor.$$.fragment, local);
current = true;
},
o(local) {
transition_out(randomcolor.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(randomcolor, detaching);
}
};
}

// (28:2) <Scene background="#000" {width} {height}>
function create_default_slot(ctx) {
let ambientlight;
let t0;
Expand All @@ -142,24 +228,24 @@ function create_default_slot(ctx) {
let t2;
let orbitexample;
let current;
ambientlight = new /*AmbientLight*/ ctx[6]({});
directionallight = new /*DirectionalLight*/ ctx[7]({});
ambientlight = new /*AmbientLight*/ ctx[5]({});
directionallight = new /*DirectionalLight*/ ctx[6]({});

emitter = new /*Emitter*/ ctx[4]({
emitter = new /*Emitter*/ ctx[3]({
props: {
position: /*emitterPosition*/ ctx[3],
size: [22, 3, 0.5],
position: /*emitterPosition*/ ctx[7],
size: [12, 3, 0.5],
direction: [0, 0, 2],
directionVariance: 0.4,
velocity: 0.25,
velocity: 0.45,
lifespan: 3000,
forces: [/*gravity*/ ctx[8]],
particlesPerSecond: 350,
particlesPerSecond: 150,
$$slots: {
default: [
create_default_slot_1,
({ position, rotation }) => ({ 12: position, 13: rotation }),
({ position, rotation }) => (position ? 4096 : 0) | (rotation ? 8192 : 0)
({ position, rotation }) => ({ 13: position, 14: rotation }),
({ position, rotation }) => (position ? 8192 : 0) | (rotation ? 16384 : 0)
]
},
$$scope: { ctx }
Expand Down Expand Up @@ -190,9 +276,8 @@ function create_default_slot(ctx) {
},
p(ctx, dirty) {
const emitter_changes = {};
if (dirty & /*emitterPosition*/ 8) emitter_changes.position = /*emitterPosition*/ ctx[3];

if (dirty & /*$$scope, position, rotation*/ 28672) {
if (dirty & /*$$scope, position, rotation*/ 90112) {
emitter_changes.$$scope = { dirty, ctx };
}

Expand Down Expand Up @@ -231,7 +316,7 @@ function create_fragment(ctx) {
let mounted;
let dispose;
add_render_callback(/*onwindowresize*/ ctx[9]);
let if_block = /*width*/ ctx[1] && /*height*/ ctx[2] && create_if_block(ctx);
let if_block = /*width*/ ctx[0] && /*height*/ ctx[1] && create_if_block(ctx);

return {
c() {
Expand All @@ -249,11 +334,11 @@ function create_fragment(ctx) {
}
},
p(ctx, [dirty]) {
if (/*width*/ ctx[1] && /*height*/ ctx[2]) {
if (/*width*/ ctx[0] && /*height*/ ctx[1]) {
if (if_block) {
if_block.p(ctx, dirty);

if (dirty & /*width, height*/ 6) {
if (dirty & /*width, height*/ 3) {
transition_in(if_block, 1);
}
} else {
Expand Down Expand Up @@ -291,8 +376,9 @@ function create_fragment(ctx) {
}

function instance($$self, $$props, $$invalidate) {
const { RandomColor } = numbers;
const { Emitter, Forces } = mograph;
const { Icosahedron } = primitives;
const { Icosahedron, Plane } = primitives;
const { AmbientLight, DirectionalLight } = lights;
let width;
let height;
Expand All @@ -301,35 +387,21 @@ function instance($$self, $$props, $$invalidate) {
const gravity = particle => particle.getVector(0, -0.0001, 0);

function onwindowresize() {
$$invalidate(1, width = window.innerWidth)
$$invalidate(2, height = window.innerHeight)
}

function scene_ctx_binding(value) {
sceneCtx = value;
$$invalidate(0, sceneCtx);
$$invalidate(0, width = window.innerWidth)
$$invalidate(1, height = window.innerHeight)
}

$$self.$$.update = () => {
if ($$self.$$.dirty & /*sceneCtx*/ 1) {
$: sceneCtx && sceneCtx.time.subscribe(t => {
$$invalidate(3, emitterPosition[0] = Math.sin(t / 1000), emitterPosition);
});
}
};

return [
sceneCtx,
width,
height,
emitterPosition,
RandomColor,
Emitter,
Icosahedron,
AmbientLight,
DirectionalLight,
emitterPosition,
gravity,
onwindowresize,
scene_ctx_binding
onwindowresize
];
}

Expand Down
Loading

0 comments on commit 8409b4b

Please sign in to comment.