瀏覽代碼

Add M&Ms and skittles

tags/v0.1.0
Fen Dweller 5 年之前
父節點
當前提交
cc15b2e36f
共有 3 個文件被更改,包括 40 次插入13 次删除
  1. +9
    -0
      media/attribution.js
  2. +20
    -10
      presets/food.js
  3. +11
    -3
      presets/objects.js

+ 9
- 0
media/attribution.js 查看文件

@@ -7120,6 +7120,15 @@ const attributionData = {
"dimensions-guide"
]
},
{
prefix: "./media/food/candy/",
files: [
],
authors: [
"chemicalcrux"
]
},
{
prefix: "./media/food/dinosaurs/",
files: [


+ 20
- 10
presets/food.js 查看文件

@@ -70,11 +70,11 @@ function makeFood() {

results.push(
makeHeightWeight([
["blue-whale", 4.5, 125e3],
["sperm-whale", 3, 42e3],
["dairy-cow", 1.7, 800],
["horse", 2.08, 550],
["african-elephant", 3.2, 4000]
["blue-whale", 4.5, "meters", 125e3, "kg"],
["sperm-whale", 3, "meters", 42e3, "kg"],
["dairy-cow", 1.7, "meters", 800, "kg"],
["horse", 2.08, "meters", 550, "kg"],
["african-elephant", 3.2, "meters", 4000, "kg"]
],
"Animals",
"",
@@ -83,11 +83,11 @@ function makeFood() {

results.push(
makeHeightWeight([
["brachiosaurus", 13, 56e3],
["pterodactyl", 2.3, 200],
["stegosaurus", 4.5, 7e3],
["tyrannosaurus", 5.2, 14e3],
["velociraptor", 1.6, 15]
["brachiosaurus", 13, "meters", 56e3, "kg"],
["pterodactyl", 2.3, "meters", 200, "kg"],
["stegosaurus", 4.5, "meters", 7e3, "kg"],
["tyrannosaurus", 5.2, "meters", 14e3, "kg"],
["velociraptor", 1.6, "meters", 15, "kg"]
],
"Dinosaurs",
"",
@@ -122,6 +122,16 @@ function makeFood() {
"food"
));

results.push(makeHeightWeight(
[
["m&m", 0.5262, "inches", 43/50, "g", "./media/objects/circle.svg"],
["skittle", 0.50, "inches", 53/50, "g", "./media/objects/circle.svg"],
],
"Candy",
"",
"food"
))

results.sort((b1, b2) => {
e1 = b1.constructor();
e2 = b2.constructor();


+ 11
- 3
presets/objects.js 查看文件

@@ -72,10 +72,18 @@ function makeHeight(info, category, prefix="", type="objects") {
function makeHeightWeight(info, category, prefix="", type="objects") {
const views = {};
info.forEach(object => {
let src;
// this lets us provide our own source if needed
// useful for reusing existing art
if (object[5]) {
src = object[5];
} else {
src = "./media/" + type + "/" + category.replace(/ /g, "-").toLowerCase() + "/" + prefix + object[0] + ".svg";
}
views[object[0]] = {
height: math.unit(object[1], "meters"),
mass: math.unit(object[2], "kilograms"),
image: { source: "./media/" + type + "/" + category.replace(/ /g, "-").toLowerCase() + "/" + prefix + object[0] + ".svg" },
height: math.unit(object[1], object[2]),
mass: math.unit(object[3], object[4]),
image: { source: src },
name: object[0].replace(/-/g, " ").replace(/\b\w/g, x => x.toUpperCase()),
rename: true
}


Loading…
取消
儲存