Skip to content

Commit

Permalink
chore(release): 1.1.1 [skip ci]
Browse files Browse the repository at this point in the history
## [1.1.1](v1.1.0...v1.1.1) (2021-01-16)

### Bug Fixes

* tweak demo ([ab8ee4e](ab8ee4e))
  • Loading branch information
semantic-release-bot committed Jan 16, 2021
1 parent ab8ee4e commit 1469475
Show file tree
Hide file tree
Showing 4 changed files with 166 additions and 33 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [1.1.1](https://github.com/6eDesign/svelte-three-mograph/compare/v1.1.0...v1.1.1) (2021-01-16)


### Bug Fixes

* tweak demo ([ab8ee4e](https://github.com/6eDesign/svelte-three-mograph/commit/ab8ee4edce5eb80a42a3660f9af9a6bfa5b7c801))

# [1.1.0](https://github.com/6eDesign/svelte-three-mograph/compare/v1.0.17...v1.1.0) (2021-01-15)


Expand Down
163 changes: 145 additions & 18 deletions docs/_dist_/ClonerExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,27 @@ import {
SvelteComponent,
create_component,
destroy_component,
detach,
init,
insert,
mount_component,
safe_not_equal,
space,
transition_in,
transition_out
} from "../web_modules/svelte/internal.js";

import { getContext, onDestroy } from "../web_modules/svelte.js";
import { Material, mograph, primitives } from "./components/index.js";

function create_default_slot_1(ctx) {
function create_default_slot_3(ctx) {
let cube;
let current;

cube = new /*Cube*/ ctx[2]({
props: {
size: 0.15,
position: /*position*/ ctx[8]
size: cubeSize,
position: /*position*/ ctx[10]
}
});

Expand All @@ -34,7 +37,7 @@ function create_default_slot_1(ctx) {
},
p(ctx, dirty) {
const cube_changes = {};
if (dirty & /*position*/ 256) cube_changes.position = /*position*/ ctx[8];
if (dirty & /*position*/ 1024) cube_changes.position = /*position*/ ctx[10];
cube.$set(cube_changes);
},
i(local) {
Expand All @@ -52,15 +55,104 @@ function create_default_slot_1(ctx) {
};
}

// (21:0) <GridCloner instances={[13, 13, 13]} {spaceBetween} {rotation} let:position>
function create_default_slot(ctx) {
// (23:0) <GridCloner instances={[7, 7, 7]} {spaceBetween} {rotation} let:position>
function create_default_slot_2(ctx) {
let material;
let current;

material = new Material({
props: {
metalness: 0.8,
roughness: 0.56,
color: "#fff",
$$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 & /*$$scope, position*/ 3072) {
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);
}
};
}

// (35:2) <Material color="#fff">
function create_default_slot_1(ctx) {
let torus;
let current;

torus = new /*Torus*/ ctx[3]({
props: {
position: /*position*/ ctx[10],
radialSegments: 30,
tubularSegments: 6,
radius: 3.8,
tube: 0.3,
rotation: [0, 0, Math.PI / 6]
}
});

return {
c() {
create_component(torus.$$.fragment);
},
m(target, anchor) {
mount_component(torus, target, anchor);
current = true;
},
p(ctx, dirty) {
const torus_changes = {};
if (dirty & /*position*/ 1024) torus_changes.position = /*position*/ ctx[10];
torus.$set(torus_changes);
},
i(local) {
if (current) return;
transition_in(torus.$$.fragment, local);
current = true;
},
o(local) {
transition_out(torus.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(torus, detaching);
}
};
}

// (29:0) <LinearCloner instances={13} spaceBetween={1} direction={[0, 0, 1]} let:position >
function create_default_slot(ctx) {
let material;
let current;

material = new Material({
props: {
color: "#fff",
$$slots: { default: [create_default_slot_1] },
$$scope: { ctx }
Expand All @@ -78,7 +170,7 @@ function create_default_slot(ctx) {
p(ctx, dirty) {
const material_changes = {};

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

Expand All @@ -101,18 +193,36 @@ function create_default_slot(ctx) {

function create_fragment(ctx) {
let gridcloner;
let t;
let linearcloner;
let current;

gridcloner = new /*GridCloner*/ ctx[3]({
gridcloner = new /*GridCloner*/ ctx[5]({
props: {
instances: [13, 13, 13],
instances: [7, 7, 7],
spaceBetween: /*spaceBetween*/ ctx[1],
rotation: /*rotation*/ ctx[0],
$$slots: {
default: [
create_default_slot_2,
({ position }) => ({ 10: position }),
({ position }) => position ? 1024 : 0
]
},
$$scope: { ctx }
}
});

linearcloner = new /*LinearCloner*/ ctx[4]({
props: {
instances: 13,
spaceBetween: 1,
direction: [0, 0, 1],
$$slots: {
default: [
create_default_slot,
({ position }) => ({ 8: position }),
({ position }) => position ? 256 : 0
({ position }) => ({ 10: position }),
({ position }) => position ? 1024 : 0
]
},
$$scope: { ctx }
Expand All @@ -122,54 +232,71 @@ function create_fragment(ctx) {
return {
c() {
create_component(gridcloner.$$.fragment);
t = space();
create_component(linearcloner.$$.fragment);
},
m(target, anchor) {
mount_component(gridcloner, target, anchor);
insert(target, t, anchor);
mount_component(linearcloner, target, anchor);
current = true;
},
p(ctx, [dirty]) {
const gridcloner_changes = {};
if (dirty & /*spaceBetween*/ 2) gridcloner_changes.spaceBetween = /*spaceBetween*/ ctx[1];
if (dirty & /*rotation*/ 1) gridcloner_changes.rotation = /*rotation*/ ctx[0];

if (dirty & /*$$scope, position*/ 768) {
if (dirty & /*$$scope, position*/ 3072) {
gridcloner_changes.$$scope = { dirty, ctx };
}

gridcloner.$set(gridcloner_changes);
const linearcloner_changes = {};

if (dirty & /*$$scope, position*/ 3072) {
linearcloner_changes.$$scope = { dirty, ctx };
}

linearcloner.$set(linearcloner_changes);
},
i(local) {
if (current) return;
transition_in(gridcloner.$$.fragment, local);
transition_in(linearcloner.$$.fragment, local);
current = true;
},
o(local) {
transition_out(gridcloner.$$.fragment, local);
transition_out(linearcloner.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(gridcloner, detaching);
if (detaching) detach(t);
destroy_component(linearcloner, detaching);
}
};
}

const spaceBetweenVariance = 0.01;
const cubeSize = 0.35;

function instance($$self, $$props, $$invalidate) {
const { Cube } = primitives;
let medianSpaceBetween;
const { Cube, Torus } = primitives;
const { LinearCloner, GridCloner, Group } = mograph;
let rotation = [0.8, 0.8, 0.8];
let spaceBetween = 0.16;
const { time } = getContext("sceneCtx");

const unsubscribe = time.subscribe(t => {
$$invalidate(0, rotation = rotation.map(n => n += 0.01));

// kinda neat effect
// spaceBetween += Math.sin(t / 1000) * 0.05;
$$invalidate(1, spaceBetween = 0.18 + Math.sin(t / 600) * 0.02);
$$invalidate(1, spaceBetween = medianSpaceBetween + Math.sin(t / 600) * spaceBetweenVariance);
});

onDestroy(unsubscribe);
return [rotation, spaceBetween, Cube, GridCloner];
$: medianSpaceBetween = cubeSize + spaceBetweenVariance + 0.005;
return [rotation, spaceBetween, Cube, Torus, LinearCloner, GridCloner];
}

class ClonerExample extends SvelteComponent {
Expand Down
27 changes: 13 additions & 14 deletions docs/_dist_/components/mograph/LinearCloner.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function create_default_slot_1(ctx) {
};
}

// (12:0) <Group {position} {rotation} {group}>
// (12:0) <Group {position} {rotation}>
function create_default_slot(ctx) {
let cloner;
let current;
Expand Down Expand Up @@ -118,49 +118,48 @@ function create_default_slot(ctx) {
}

function create_fragment(ctx) {
let group_1;
let group;
let current;

group_1 = new Group({
group = new Group({
props: {
position: /*position*/ ctx[1],
rotation: /*rotation*/ ctx[0],
group,
$$slots: { default: [create_default_slot] },
$$scope: { ctx }
}
});

return {
c() {
create_component(group_1.$$.fragment);
create_component(group.$$.fragment);
},
m(target, anchor) {
mount_component(group_1, target, anchor);
mount_component(group, target, anchor);
current = true;
},
p(ctx, [dirty]) {
const group_1_changes = {};
if (dirty & /*position*/ 2) group_1_changes.position = /*position*/ ctx[1];
if (dirty & /*rotation*/ 1) group_1_changes.rotation = /*rotation*/ ctx[0];
const group_changes = {};
if (dirty & /*position*/ 2) group_changes.position = /*position*/ ctx[1];
if (dirty & /*rotation*/ 1) group_changes.rotation = /*rotation*/ ctx[0];

if (dirty & /*$$scope, $$props, position*/ 134) {
group_1_changes.$$scope = { dirty, ctx };
group_changes.$$scope = { dirty, ctx };
}

group_1.$set(group_1_changes);
group.$set(group_changes);
},
i(local) {
if (current) return;
transition_in(group_1.$$.fragment, local);
transition_in(group.$$.fragment, local);
current = true;
},
o(local) {
transition_out(group_1.$$.fragment, local);
transition_out(group.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(group_1, detaching);
destroy_component(group, detaching);
}
};
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@6edesign/svelte-three",
"svelte": "src/components/index.js",
"main": "src/components/index.js",
"version": "1.1.0",
"version": "1.1.1",
"license": "MIT",
"keywords": [
"svelte",
Expand Down

0 comments on commit 1469475

Please sign in to comment.