Просмотр исходного кода

Add M&Ms and skittles

tags/v0.1.0
Fen Dweller 6 лет назад
Родитель
Сommit
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" "dimensions-guide"
] ]
}, },
{
prefix: "./media/food/candy/",
files: [
],
authors: [
"chemicalcrux"
]
},
{ {
prefix: "./media/food/dinosaurs/", prefix: "./media/food/dinosaurs/",
files: [ files: [


+ 20
- 10
presets/food.js Просмотреть файл

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


results.push( results.push(
makeHeightWeight([ 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", "Animals",
"", "",
@@ -83,11 +83,11 @@ function makeFood() {


results.push( results.push(
makeHeightWeight([ 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", "Dinosaurs",
"", "",
@@ -122,6 +122,16 @@ function makeFood() {
"food" "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) => { results.sort((b1, b2) => {
e1 = b1.constructor(); e1 = b1.constructor();
e2 = b2.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") { function makeHeightWeight(info, category, prefix="", type="objects") {
const views = {}; const views = {};
info.forEach(object => { 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]] = { 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()), name: object[0].replace(/-/g, " ").replace(/\b\w/g, x => x.toUpperCase()),
rename: true rename: true
} }


Загрузка…
Отмена
Сохранить