Skip to content

Commit

Permalink
add a randomizer to the config setter
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardW committed Jan 12, 2020
1 parent 7c983ce commit 5c0556b
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/components/config.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
v-model.number="inputPadAngle"
type="range"
min="0"
max="1"
max="0.5"
step="0.01"
/>
<input
Expand All @@ -17,7 +17,7 @@
<input
v-model.number="inputShrinkRouteScale"
type="range"
min="0"
min="1"
max="10"
step="1"
/>
Expand Down Expand Up @@ -46,13 +46,17 @@
v-model.number="inputChildAngleSpread"
type="range"
min="0"
max="1"
max="0.5"
step="0.01"
/>
<button @click="randomize">Randomize</button>
</div>
</template>

<script>
function randomInRange(min, max) {
return Math.random() * (max - min) + min;
}
export default {
props: {
padAngle: {
Expand Down Expand Up @@ -141,6 +145,17 @@ export default {
this.$emit("update:childAngleSpread", childAngleSpread);
}
}
},
methods: {
randomize() {
this.inputPadAngle = randomInRange(0, 0.5);
this.inputSpaceBetweenParentChild = randomInRange(0, 100);
this.inputShrinkRouteScale = randomInRange(1, 10);
this.inputScale = randomInRange(0, 2);
this.inputCornerSharpness = randomInRange(0, 300);
this.inputStartRadius = randomInRange(0, 300);
this.inputChildAngleSpread = randomInRange(0, 0.5);
}
}
};
</script>

0 comments on commit 5c0556b

Please sign in to comment.