@guilhermebkel/scenec 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -22
- package/dist/Adapters/FileReaderAdapter.d.ts +4 -0
- package/dist/Adapters/FileReaderAdapter.js +21 -0
- package/dist/Adapters/FontAdapter.d.ts +5 -0
- package/dist/Adapters/FontAdapter.js +9 -0
- package/dist/Adapters/ResvgAdapter.d.ts +11 -0
- package/dist/Adapters/ResvgAdapter.js +18 -0
- package/dist/Commands/BaseCommand.d.ts +11 -0
- package/dist/Commands/BaseCommand.js +13 -0
- package/dist/Commands/CatalogCommand.d.ts +6 -0
- package/dist/Commands/CatalogCommand.js +24 -0
- package/dist/Commands/CheckCommand.d.ts +5 -0
- package/dist/Commands/CheckCommand.js +8 -0
- package/dist/Commands/RenderCommand.d.ts +5 -0
- package/dist/Commands/RenderCommand.js +8 -0
- package/dist/Commands/SceneCommand.d.ts +11 -0
- package/dist/Commands/SceneCommand.js +70 -0
- package/dist/Commands/SchemaCommand.d.ts +5 -0
- package/dist/Commands/SchemaCommand.js +12 -0
- package/dist/Data/cities.json +312 -0
- package/dist/Data/europe.json +1 -0
- package/dist/Errors/SceneError.d.ts +4 -0
- package/dist/Errors/SceneError.js +11 -0
- package/dist/Errors/UnsafeSvgError.d.ts +3 -0
- package/dist/Errors/UnsafeSvgError.js +9 -0
- package/dist/Modules/CheckModule.d.ts +8 -0
- package/dist/Modules/CheckModule.js +16 -0
- package/dist/Modules/CompilationModule.d.ts +18 -0
- package/dist/Modules/CompilationModule.js +137 -0
- package/dist/Modules/CritiqueModule.d.ts +6 -0
- package/dist/Modules/CritiqueModule.js +43 -0
- package/dist/Modules/MapModule.d.ts +24 -0
- package/dist/Modules/MapModule.js +99 -0
- package/dist/Modules/ParsingModule.d.ts +17 -0
- package/dist/Modules/ParsingModule.js +88 -0
- package/dist/Modules/PlaneModule.d.ts +19 -0
- package/dist/Modules/PlaneModule.js +98 -0
- package/dist/Protocols/AssetProtocol.d.ts +62 -0
- package/dist/Protocols/AssetProtocol.js +93 -0
- package/dist/Protocols/CommandProtocol.d.ts +6 -0
- package/dist/Protocols/CommandProtocol.js +0 -0
- package/dist/Protocols/CompilationProtocol.d.ts +110 -0
- package/dist/Protocols/CompilationProtocol.js +0 -0
- package/dist/Protocols/CritiqueProtocol.d.ts +42 -0
- package/dist/Protocols/CritiqueProtocol.js +4 -0
- package/dist/Protocols/CustomAssetProtocol.d.ts +24 -0
- package/dist/Protocols/CustomAssetProtocol.js +0 -0
- package/dist/Protocols/GroupProtocol.d.ts +17 -0
- package/dist/Protocols/GroupProtocol.js +12 -0
- package/dist/Protocols/KitProtocol.d.ts +26 -0
- package/dist/Protocols/KitProtocol.js +17 -0
- package/dist/Protocols/MapProtocol.d.ts +77 -0
- package/dist/Protocols/MapProtocol.js +4 -0
- package/dist/Protocols/OptionsProtocol.js +0 -0
- package/dist/Protocols/PersonProtocol.d.ts +64 -0
- package/dist/Protocols/PersonProtocol.js +40 -0
- package/dist/Protocols/PlaneProtocol.d.ts +140 -0
- package/dist/Protocols/PlaneProtocol.js +4 -0
- package/dist/{pipeline/index.d.ts → Protocols/ResultProtocol.d.ts} +0 -2
- package/dist/Protocols/ResultProtocol.js +0 -0
- package/dist/Protocols/SceneProtocol.d.ts +625 -0
- package/dist/Protocols/SceneProtocol.js +304 -0
- package/dist/{protocols/theme.d.ts → Protocols/ThemeProtocol.d.ts} +4 -0
- package/dist/Protocols/ThemeProtocol.js +28 -0
- package/dist/Resources/Assets/BackpackAsset.d.ts +10 -0
- package/dist/Resources/Assets/BackpackAsset.js +31 -0
- package/dist/Resources/Assets/BallAsset.d.ts +10 -0
- package/dist/Resources/Assets/BallAsset.js +15 -0
- package/dist/Resources/Assets/BalloonsAsset.d.ts +10 -0
- package/dist/Resources/Assets/BalloonsAsset.js +26 -0
- package/dist/Resources/Assets/BaseAsset.d.ts +16 -0
- package/dist/Resources/Assets/BaseAsset.js +10 -0
- package/dist/Resources/Assets/BeachTowelAsset.d.ts +10 -0
- package/dist/Resources/Assets/BeachTowelAsset.js +14 -0
- package/dist/Resources/Assets/BedAsset.d.ts +12 -0
- package/dist/Resources/Assets/BedAsset.js +25 -0
- package/dist/Resources/Assets/BenchAsset.d.ts +11 -0
- package/dist/Resources/Assets/BenchAsset.js +24 -0
- package/dist/Resources/Assets/BicycleAsset.d.ts +10 -0
- package/dist/Resources/Assets/BicycleAsset.js +18 -0
- package/dist/Resources/Assets/BigPlantAsset.d.ts +10 -0
- package/dist/Resources/Assets/BigPlantAsset.js +19 -0
- package/dist/Resources/Assets/BirdAsset.d.ts +10 -0
- package/dist/Resources/Assets/BirdAsset.js +14 -0
- package/dist/Resources/Assets/BoardAsset.d.ts +12 -0
- package/dist/Resources/Assets/BoardAsset.js +44 -0
- package/dist/Resources/Assets/BoatAsset.d.ts +10 -0
- package/dist/Resources/Assets/BoatAsset.js +15 -0
- package/dist/Resources/Assets/BooksAsset.d.ts +10 -0
- package/dist/Resources/Assets/BooksAsset.js +35 -0
- package/dist/Resources/Assets/BookshelfAsset.d.ts +10 -0
- package/dist/Resources/Assets/BookshelfAsset.js +33 -0
- package/dist/Resources/Assets/BuildingAsset.d.ts +14 -0
- package/dist/Resources/Assets/BuildingAsset.js +34 -0
- package/dist/Resources/Assets/BurgerAsset.d.ts +9 -0
- package/dist/Resources/Assets/BurgerAsset.js +23 -0
- package/dist/Resources/Assets/BushAsset.d.ts +10 -0
- package/dist/Resources/Assets/BushAsset.js +17 -0
- package/dist/Resources/Assets/CabinetAsset.d.ts +14 -0
- package/dist/Resources/Assets/CabinetAsset.js +49 -0
- package/dist/Resources/Assets/CablesAsset.d.ts +10 -0
- package/dist/Resources/Assets/CablesAsset.js +16 -0
- package/dist/Resources/Assets/CakeAsset.d.ts +10 -0
- package/dist/Resources/Assets/CakeAsset.js +29 -0
- package/dist/Resources/Assets/CapAsset.d.ts +10 -0
- package/dist/Resources/Assets/CapAsset.js +18 -0
- package/dist/Resources/Assets/CarAsset.d.ts +10 -0
- package/dist/Resources/Assets/CarAsset.js +29 -0
- package/dist/Resources/Assets/CatAsset.d.ts +10 -0
- package/dist/Resources/Assets/CatAsset.js +17 -0
- package/dist/Resources/Assets/ChairAsset.d.ts +11 -0
- package/dist/Resources/Assets/ChairAsset.js +32 -0
- package/dist/Resources/Assets/ClockAsset.d.ts +11 -0
- package/dist/Resources/Assets/ClockAsset.js +22 -0
- package/dist/Resources/Assets/CloudAsset.d.ts +10 -0
- package/dist/Resources/Assets/CloudAsset.js +15 -0
- package/dist/Resources/Assets/CoffeeMachineAsset.d.ts +10 -0
- package/dist/Resources/Assets/CoffeeMachineAsset.js +23 -0
- package/dist/Resources/Assets/CounterAsset.d.ts +11 -0
- package/dist/Resources/Assets/CounterAsset.js +29 -0
- package/dist/Resources/Assets/CupAsset.d.ts +10 -0
- package/dist/Resources/Assets/CupAsset.js +17 -0
- package/dist/Resources/Assets/CustomAsset.d.ts +25 -0
- package/dist/Resources/Assets/CustomAsset.js +58 -0
- package/dist/Resources/Assets/DeskAsset.d.ts +11 -0
- package/dist/Resources/Assets/DeskAsset.js +35 -0
- package/dist/Resources/Assets/DeskSlabAsset.d.ts +18 -0
- package/dist/Resources/Assets/DeskSlabAsset.js +43 -0
- package/dist/Resources/Assets/DiplomaAsset.d.ts +10 -0
- package/dist/Resources/Assets/DiplomaAsset.js +23 -0
- package/dist/Resources/Assets/DogAsset.d.ts +10 -0
- package/dist/Resources/Assets/DogAsset.js +24 -0
- package/dist/Resources/Assets/DrawerUnitAsset.d.ts +14 -0
- package/dist/Resources/Assets/DrawerUnitAsset.js +35 -0
- package/dist/Resources/Assets/FenceAsset.d.ts +10 -0
- package/dist/Resources/Assets/FenceAsset.js +26 -0
- package/dist/Resources/Assets/FigurineAsset.d.ts +10 -0
- package/dist/Resources/Assets/FigurineAsset.js +24 -0
- package/dist/Resources/Assets/FinishFlagAsset.d.ts +10 -0
- package/dist/Resources/Assets/FinishFlagAsset.js +21 -0
- package/dist/Resources/Assets/FloorLampAsset.d.ts +10 -0
- package/dist/Resources/Assets/FloorLampAsset.js +22 -0
- package/dist/Resources/Assets/FlowersAsset.d.ts +10 -0
- package/dist/Resources/Assets/FlowersAsset.js +37 -0
- package/dist/Resources/Assets/FrameAsset.d.ts +11 -0
- package/dist/Resources/Assets/FrameAsset.js +24 -0
- package/dist/Resources/Assets/FruitBowlAsset.d.ts +10 -0
- package/dist/Resources/Assets/FruitBowlAsset.js +16 -0
- package/dist/Resources/Assets/GlassShelfAsset.d.ts +17 -0
- package/dist/Resources/Assets/GlassShelfAsset.js +25 -0
- package/dist/Resources/Assets/HeadphonesAsset.d.ts +10 -0
- package/dist/Resources/Assets/HeadphonesAsset.js +23 -0
- package/dist/Resources/Assets/HouseAsset.d.ts +10 -0
- package/dist/Resources/Assets/HouseAsset.js +42 -0
- package/dist/Resources/Assets/LabAsset.d.ts +10 -0
- package/dist/Resources/Assets/LabAsset.js +52 -0
- package/dist/Resources/Assets/LampAsset.d.ts +10 -0
- package/dist/Resources/Assets/LampAsset.js +16 -0
- package/dist/Resources/Assets/LaptopAsset.d.ts +10 -0
- package/dist/Resources/Assets/LaptopAsset.js +23 -0
- package/dist/Resources/Assets/LaptopOpenAsset.d.ts +10 -0
- package/dist/Resources/Assets/LaptopOpenAsset.js +29 -0
- package/dist/Resources/Assets/LightSwitchAsset.d.ts +11 -0
- package/dist/Resources/Assets/LightSwitchAsset.js +24 -0
- package/dist/Resources/Assets/MonitorAsset.d.ts +10 -0
- package/dist/Resources/Assets/MonitorAsset.js +40 -0
- package/dist/Resources/Assets/MoonAsset.d.ts +10 -0
- package/dist/Resources/Assets/MoonAsset.js +16 -0
- package/dist/Resources/Assets/MountainAsset.d.ts +10 -0
- package/dist/Resources/Assets/MountainAsset.js +15 -0
- package/dist/Resources/Assets/OfficeChairAsset.d.ts +10 -0
- package/dist/Resources/Assets/OfficeChairAsset.js +45 -0
- package/dist/Resources/Assets/PalmAsset.d.ts +10 -0
- package/dist/Resources/Assets/PalmAsset.js +32 -0
- package/dist/Resources/Assets/PaperCupAsset.d.ts +10 -0
- package/dist/Resources/Assets/PaperCupAsset.js +17 -0
- package/dist/Resources/Assets/PendantLampAsset.d.ts +10 -0
- package/dist/Resources/Assets/PendantLampAsset.js +16 -0
- package/dist/Resources/Assets/PennantAsset.d.ts +10 -0
- package/dist/Resources/Assets/PennantAsset.js +15 -0
- package/dist/Resources/Assets/PersonAsset.d.ts +10 -0
- package/dist/Resources/Assets/PersonAsset.js +15 -0
- package/dist/Resources/Assets/PhotoFrameAsset.d.ts +15 -0
- package/dist/Resources/Assets/PhotoFrameAsset.js +68 -0
- package/dist/Resources/Assets/PineAsset.d.ts +10 -0
- package/dist/Resources/Assets/PineAsset.js +21 -0
- package/dist/Resources/Assets/PizzaAsset.d.ts +10 -0
- package/dist/Resources/Assets/PizzaAsset.js +17 -0
- package/dist/Resources/Assets/PlantAsset.d.ts +10 -0
- package/dist/Resources/Assets/PlantAsset.js +17 -0
- package/dist/Resources/Assets/PlasticBagAsset.d.ts +10 -0
- package/dist/Resources/Assets/PlasticBagAsset.js +15 -0
- package/dist/Resources/Assets/PlateAsset.d.ts +10 -0
- package/dist/Resources/Assets/PlateAsset.js +17 -0
- package/dist/Resources/Assets/RollingCartAsset.d.ts +11 -0
- package/dist/Resources/Assets/RollingCartAsset.js +34 -0
- package/dist/Resources/Assets/RugAsset.d.ts +10 -0
- package/dist/Resources/Assets/RugAsset.js +19 -0
- package/dist/Resources/Assets/SandcastleAsset.d.ts +10 -0
- package/dist/Resources/Assets/SandcastleAsset.js +30 -0
- package/dist/Resources/Assets/SchoolAsset.d.ts +10 -0
- package/dist/Resources/Assets/SchoolAsset.js +32 -0
- package/dist/Resources/Assets/ShelfWallAsset.d.ts +11 -0
- package/dist/Resources/Assets/ShelfWallAsset.js +23 -0
- package/dist/Resources/Assets/SofaAsset.d.ts +11 -0
- package/dist/Resources/Assets/SofaAsset.js +38 -0
- package/dist/Resources/Assets/StageAsset.d.ts +10 -0
- package/dist/Resources/Assets/StageAsset.js +44 -0
- package/dist/Resources/Assets/StarAsset.d.ts +10 -0
- package/dist/Resources/Assets/StarAsset.js +14 -0
- package/dist/Resources/Assets/StarsAsset.d.ts +11 -0
- package/dist/Resources/Assets/StarsAsset.js +42 -0
- package/dist/Resources/Assets/StreetlightAsset.d.ts +10 -0
- package/dist/Resources/Assets/StreetlightAsset.js +20 -0
- package/dist/Resources/Assets/SuitcaseAsset.d.ts +10 -0
- package/dist/Resources/Assets/SuitcaseAsset.js +42 -0
- package/dist/Resources/Assets/SunAsset.d.ts +10 -0
- package/dist/Resources/Assets/SunAsset.js +22 -0
- package/dist/Resources/Assets/TableAsset.d.ts +15 -0
- package/dist/Resources/Assets/TableAsset.js +21 -0
- package/dist/Resources/Assets/TrashCanAsset.d.ts +10 -0
- package/dist/Resources/Assets/TrashCanAsset.js +31 -0
- package/dist/Resources/Assets/TreeAsset.d.ts +10 -0
- package/dist/Resources/Assets/TreeAsset.js +23 -0
- package/dist/Resources/Assets/TrophyAsset.d.ts +10 -0
- package/dist/Resources/Assets/TrophyAsset.js +16 -0
- package/dist/Resources/Assets/TumblerAsset.d.ts +10 -0
- package/dist/Resources/Assets/TumblerAsset.js +17 -0
- package/dist/Resources/Assets/TvAsset.d.ts +10 -0
- package/dist/Resources/Assets/TvAsset.js +29 -0
- package/dist/Resources/Assets/TvStandAsset.d.ts +11 -0
- package/dist/Resources/Assets/TvStandAsset.js +34 -0
- package/dist/Resources/Assets/UmbrellaAsset.d.ts +10 -0
- package/dist/Resources/Assets/UmbrellaAsset.js +17 -0
- package/dist/Resources/Assets/UniversityAsset.d.ts +10 -0
- package/dist/Resources/Assets/UniversityAsset.js +22 -0
- package/dist/Resources/Assets/VaseFlowersAsset.d.ts +10 -0
- package/dist/Resources/Assets/VaseFlowersAsset.js +16 -0
- package/dist/Resources/Assets/WindowAsset.d.ts +11 -0
- package/dist/Resources/Assets/WindowAsset.js +32 -0
- package/dist/Resources/Groups/BaseGroup.d.ts +7 -0
- package/dist/Resources/Groups/BaseGroup.js +5 -0
- package/dist/Resources/Groups/CelebrationGroup.d.ts +8 -0
- package/dist/Resources/Groups/CelebrationGroup.js +19 -0
- package/dist/Resources/Groups/ConversationGroup.d.ts +9 -0
- package/dist/Resources/Groups/ConversationGroup.js +17 -0
- package/dist/Resources/Groups/DiningGroup.d.ts +8 -0
- package/dist/Resources/Groups/DiningGroup.js +21 -0
- package/dist/Resources/Groups/MeetingGroup.d.ts +8 -0
- package/dist/Resources/Groups/MeetingGroup.js +22 -0
- package/dist/Resources/Groups/ParkBenchGroup.d.ts +8 -0
- package/dist/Resources/Groups/ParkBenchGroup.js +17 -0
- package/dist/Resources/Groups/ReadingCornerGroup.d.ts +8 -0
- package/dist/Resources/Groups/ReadingCornerGroup.js +17 -0
- package/dist/Resources/Groups/WorkspaceGroup.d.ts +10 -0
- package/dist/Resources/Groups/WorkspaceGroup.js +25 -0
- package/dist/Resources/Kits/BaseKit.d.ts +12 -0
- package/dist/Resources/Kits/BaseKit.js +11 -0
- package/dist/Resources/Kits/FlatKit.d.ts +5 -0
- package/dist/Resources/Kits/FlatKit.js +8 -0
- package/dist/Resources/Kits/HatchKit.d.ts +15 -0
- package/dist/Resources/Kits/HatchKit.js +12 -0
- package/dist/Resources/Kits/OutlineKit.d.ts +12 -0
- package/dist/Resources/Kits/OutlineKit.js +10 -0
- package/dist/Resources/Kits/PaperKit.d.ts +11 -0
- package/dist/Resources/Kits/PaperKit.js +11 -0
- package/dist/Resources/Kits/RisoKit.d.ts +16 -0
- package/dist/Resources/Kits/RisoKit.js +11 -0
- package/dist/Resources/Kits/SketchKit.d.ts +9 -0
- package/dist/Resources/Kits/SketchKit.js +11 -0
- package/dist/Resources/Themes/BaseTheme.d.ts +5 -0
- package/dist/Resources/Themes/BaseTheme.js +5 -0
- package/dist/Resources/Themes/BeachTheme.d.ts +6 -0
- package/dist/Resources/Themes/BeachTheme.js +31 -0
- package/dist/Resources/Themes/FlatAutumnTheme.d.ts +6 -0
- package/dist/Resources/Themes/FlatAutumnTheme.js +29 -0
- package/dist/Resources/Themes/FlatCoolTheme.d.ts +6 -0
- package/dist/Resources/Themes/FlatCoolTheme.js +29 -0
- package/dist/Resources/Themes/NightTheme.d.ts +6 -0
- package/dist/Resources/Themes/NightTheme.js +29 -0
- package/dist/Resources/Themes/WarmCafeTheme.d.ts +6 -0
- package/dist/Resources/Themes/WarmCafeTheme.js +29 -0
- package/dist/Services/AssetService.d.ts +12 -0
- package/dist/Services/AssetService.js +204 -0
- package/dist/Services/BackgroundService.d.ts +33 -0
- package/dist/Services/BackgroundService.js +136 -0
- package/dist/Services/BalanceCritiqueService.d.ts +13 -0
- package/dist/Services/BalanceCritiqueService.js +64 -0
- package/dist/Services/CameraService.d.ts +21 -0
- package/dist/Services/CameraService.js +121 -0
- package/dist/Services/CatalogService.d.ts +29 -0
- package/dist/Services/CatalogService.js +51 -0
- package/dist/Services/ContactCritiqueService.d.ts +19 -0
- package/dist/Services/ContactCritiqueService.js +101 -0
- package/dist/Services/ContextService.d.ts +21 -0
- package/dist/Services/ContextService.js +94 -0
- package/dist/Services/CoverageCritiqueService.d.ts +16 -0
- package/dist/Services/CoverageCritiqueService.js +84 -0
- package/dist/Services/CustomAssetService.d.ts +31 -0
- package/dist/Services/CustomAssetService.js +184 -0
- package/dist/Services/DependencyOrderService.d.ts +12 -0
- package/dist/Services/DependencyOrderService.js +73 -0
- package/dist/Services/DescriptionService.d.ts +9 -0
- package/dist/Services/DescriptionService.js +27 -0
- package/dist/Services/FramingCheckService.d.ts +15 -0
- package/dist/Services/FramingCheckService.js +93 -0
- package/dist/Services/GazeService.d.ts +6 -0
- package/dist/Services/GazeService.js +43 -0
- package/dist/Services/GroupService.d.ts +17 -0
- package/dist/Services/GroupService.js +152 -0
- package/dist/Services/KitService.d.ts +23 -0
- package/dist/Services/KitService.js +96 -0
- package/dist/Services/LightingService.d.ts +24 -0
- package/dist/Services/LightingService.js +119 -0
- package/dist/Services/MapBaseService.d.ts +24 -0
- package/dist/Services/MapBaseService.js +104 -0
- package/dist/Services/MapLabelService.d.ts +26 -0
- package/dist/Services/MapLabelService.js +185 -0
- package/dist/Services/MapLegService.d.ts +23 -0
- package/dist/Services/MapLegService.js +87 -0
- package/dist/Services/MapPanelService.d.ts +16 -0
- package/dist/Services/MapPanelService.js +89 -0
- package/dist/Services/MapPinService.d.ts +11 -0
- package/dist/Services/MapPinService.js +56 -0
- package/dist/Services/MapProjectionService.d.ts +14 -0
- package/dist/Services/MapProjectionService.js +70 -0
- package/dist/Services/MapRouteService.d.ts +17 -0
- package/dist/Services/MapRouteService.js +79 -0
- package/dist/Services/PieceService.d.ts +43 -0
- package/dist/Services/PieceService.js +154 -0
- package/dist/Services/PlacementService.d.ts +60 -0
- package/dist/Services/PlacementService.js +415 -0
- package/dist/Services/PlaneBackgroundService.d.ts +24 -0
- package/dist/Services/PlaneBackgroundService.js +170 -0
- package/dist/Services/PlaneBoxService.d.ts +27 -0
- package/dist/Services/PlaneBoxService.js +209 -0
- package/dist/Services/PlaneDepthService.d.ts +18 -0
- package/dist/Services/PlaneDepthService.js +146 -0
- package/dist/Services/PlaneLabelService.d.ts +13 -0
- package/dist/Services/PlaneLabelService.js +115 -0
- package/dist/Services/PlaneObjectService.d.ts +17 -0
- package/dist/Services/PlaneObjectService.js +147 -0
- package/dist/Services/PlanePathService.d.ts +15 -0
- package/dist/Services/PlanePathService.js +98 -0
- package/dist/Services/PlaneProjectionService.d.ts +16 -0
- package/dist/Services/PlaneProjectionService.js +90 -0
- package/dist/Services/PlaneRoadService.d.ts +13 -0
- package/dist/Services/PlaneRoadService.js +105 -0
- package/dist/Services/PlaneScatterService.d.ts +11 -0
- package/dist/Services/PlaneScatterService.js +48 -0
- package/dist/Services/PlaneSpaceService.d.ts +27 -0
- package/dist/Services/PlaneSpaceService.js +96 -0
- package/dist/Services/PlaneSpriteService.d.ts +29 -0
- package/dist/Services/PlaneSpriteService.js +95 -0
- package/dist/Services/PlaneTitleService.d.ts +17 -0
- package/dist/Services/PlaneTitleService.js +126 -0
- package/dist/Services/PlaneZoneService.d.ts +20 -0
- package/dist/Services/PlaneZoneService.js +121 -0
- package/dist/Services/RasterService.d.ts +10 -0
- package/dist/Services/RasterService.js +68 -0
- package/dist/Services/SchemaService.d.ts +3 -0
- package/dist/Services/SchemaService.js +10 -0
- package/dist/Services/SilhouetteCritiqueService.d.ts +32 -0
- package/dist/Services/SilhouetteCritiqueService.js +155 -0
- package/dist/Services/TextService.d.ts +47 -0
- package/dist/Services/TextService.js +178 -0
- package/dist/Services/ThemeService.d.ts +5 -0
- package/dist/Services/ThemeService.js +18 -0
- package/dist/Utils/BoxUtil.d.ts +4 -0
- package/dist/Utils/BoxUtil.js +8 -0
- package/dist/Utils/ColorUtil.d.ts +20 -0
- package/dist/Utils/ColorUtil.js +51 -0
- package/dist/Utils/CurveUtil.d.ts +6 -0
- package/dist/Utils/CurveUtil.js +35 -0
- package/dist/Utils/FallbackUtil.d.ts +3 -0
- package/dist/Utils/FallbackUtil.js +8 -0
- package/dist/Utils/FormatUtil.d.ts +4 -0
- package/dist/Utils/FormatUtil.js +9 -0
- package/dist/Utils/IdUtil.d.ts +4 -0
- package/dist/Utils/IdUtil.js +11 -0
- package/dist/Utils/NormalizeUtil.d.ts +4 -0
- package/dist/Utils/NormalizeUtil.js +9 -0
- package/dist/Utils/OklabUtil.d.ts +23 -0
- package/dist/Utils/OklabUtil.js +62 -0
- package/dist/Utils/PersonArmUtil.d.ts +19 -0
- package/dist/Utils/PersonArmUtil.js +84 -0
- package/dist/Utils/PersonHeadUtil.d.ts +31 -0
- package/dist/Utils/PersonHeadUtil.js +154 -0
- package/dist/Utils/PersonOutfitUtil.d.ts +48 -0
- package/dist/Utils/PersonOutfitUtil.js +178 -0
- package/dist/Utils/PersonUtil.d.ts +39 -0
- package/dist/Utils/PersonUtil.js +206 -0
- package/dist/Utils/PixelUtil.d.ts +3 -0
- package/dist/Utils/PixelUtil.js +8 -0
- package/dist/Utils/RecolorUtil.d.ts +40 -0
- package/dist/Utils/RecolorUtil.js +155 -0
- package/dist/Utils/RegistryUtil.d.ts +8 -0
- package/dist/Utils/RegistryUtil.js +19 -0
- package/dist/Utils/RequireUtil.d.ts +3 -0
- package/dist/Utils/RequireUtil.js +11 -0
- package/dist/Utils/SanitizeUtil.d.ts +25 -0
- package/dist/Utils/SanitizeUtil.js +210 -0
- package/dist/Utils/SeedUtil.d.ts +6 -0
- package/dist/Utils/SeedUtil.js +15 -0
- package/dist/Utils/ShapeUtil.d.ts +31 -0
- package/dist/Utils/ShapeUtil.js +47 -0
- package/dist/Utils/SuggestUtil.d.ts +7 -0
- package/dist/Utils/SuggestUtil.js +25 -0
- package/dist/Utils/SvgUtil.d.ts +9 -0
- package/dist/Utils/SvgUtil.js +21 -0
- package/dist/Utils/ThemeUtil.d.ts +4 -0
- package/dist/Utils/ThemeUtil.js +13 -0
- package/dist/Utils/TransportUtil.d.ts +24 -0
- package/dist/Utils/TransportUtil.js +108 -0
- package/dist/cli.js +24 -97
- package/dist/index.d.ts +10 -6
- package/dist/index.js +14 -2
- package/dist/render.d.ts +8 -5
- package/dist/render.js +21 -3
- package/dist/schema.d.ts +9 -2
- package/dist/schema.js +29 -5
- package/package.json +3 -2
- package/skills/{scenec → draw-scene}/SKILL.md +15 -19
- package/skills/{scenec → draw-scene}/references/catalog.md +14 -14
- package/skills/{scenec → draw-scene}/references/dsl.md +9 -3
- package/dist/catalog.d.ts +0 -21
- package/dist/catalog.js +0 -35
- package/dist/data/europe.json +0 -1
- package/dist/drawing/assets.d.ts +0 -8
- package/dist/drawing/assets.js +0 -612
- package/dist/drawing/kits.d.ts +0 -7
- package/dist/drawing/kits.js +0 -92
- package/dist/drawing/person.d.ts +0 -18
- package/dist/drawing/person.js +0 -287
- package/dist/drawing/themes.d.ts +0 -4
- package/dist/drawing/themes.js +0 -45
- package/dist/modes/map.d.ts +0 -5
- package/dist/modes/map.js +0 -365
- package/dist/modes/plane.d.ts +0 -5
- package/dist/modes/plane.js +0 -716
- package/dist/pipeline/compile.d.ts +0 -2
- package/dist/pipeline/compile.js +0 -581
- package/dist/pipeline/custom.d.ts +0 -2
- package/dist/pipeline/custom.js +0 -120
- package/dist/pipeline/groups.d.ts +0 -2
- package/dist/pipeline/groups.js +0 -189
- package/dist/pipeline/index.js +0 -7
- package/dist/pipeline/parse.d.ts +0 -10
- package/dist/pipeline/parse.js +0 -80
- package/dist/protocols/options.js +0 -1
- package/dist/protocols/scene.d.ts +0 -299
- package/dist/protocols/scene.js +0 -118
- package/dist/protocols/theme.js +0 -1
- package/dist/render/check.d.ts +0 -6
- package/dist/render/check.js +0 -10
- package/dist/render/critic.d.ts +0 -1
- package/dist/render/critic.js +0 -235
- package/dist/render/files.d.ts +0 -2
- package/dist/render/files.js +0 -16
- package/dist/render/fonts.d.ts +0 -2
- package/dist/render/fonts.js +0 -4
- package/dist/render/png.d.ts +0 -9
- package/dist/render/png.js +0 -13
- package/dist/utils/color.d.ts +0 -5
- package/dist/utils/color.js +0 -35
- package/dist/utils/recolor.d.ts +0 -1
- package/dist/utils/recolor.js +0 -56
- package/dist/utils/sanitize.d.ts +0 -5
- package/dist/utils/sanitize.js +0 -169
- package/dist/utils/suggest.d.ts +0 -1
- package/dist/utils/suggest.js +0 -22
- package/dist/utils/svg.d.ts +0 -2
- package/dist/utils/svg.js +0 -11
- package/skills/scenec/references/fontes.md +0 -8
- /package/dist/{protocols/options.d.ts → Protocols/OptionsProtocol.d.ts} +0 -0
- /package/skills/{scenec/recipes/anuncios-variacoes.yaml → draw-scene/recipes/ad-variations.yaml} +0 -0
- /package/skills/{scenec/recipes/carrossel.yaml → draw-scene/recipes/carousel.yaml} +0 -0
- /package/skills/{scenec/recipes/elearning.yaml → draw-scene/recipes/e-learning.yaml} +0 -0
- /package/skills/{scenec/recipes/reels-explicativo.yaml → draw-scene/recipes/explainer-reel.yaml} +0 -0
- /package/skills/{scenec/recipes/historia-ilustrada.yaml → draw-scene/recipes/illustrated-story.yaml} +0 -0
- /package/skills/{scenec/recipes/mapas-jornadas.yaml → draw-scene/recipes/journey-map.yaml} +0 -0
- /package/skills/{scenec/recipes/wrapped-personalizado.yaml → draw-scene/recipes/personalized-wrapped.yaml} +0 -0
- /package/skills/{scenec/recipes/ilustracoes-produto.yaml → draw-scene/recipes/product-illustration.yaml} +0 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { ColorUtil } from "./ColorUtil.js";
|
|
2
|
+
import { FallbackUtil } from "./FallbackUtil.js";
|
|
3
|
+
import { IdUtil } from "./IdUtil.js";
|
|
4
|
+
import { PersonArmUtil } from "./PersonArmUtil.js";
|
|
5
|
+
class PersonHeadUtil {
|
|
6
|
+
static SKIN_NAME_TO_COLOR = {
|
|
7
|
+
light: "#F2C9A5",
|
|
8
|
+
medium: "#D19A6E",
|
|
9
|
+
tan: "#B87A50",
|
|
10
|
+
dark: "#7A4B30",
|
|
11
|
+
deep: "#5A3522"
|
|
12
|
+
};
|
|
13
|
+
static HAIR_NAME_TO_COLOR = {
|
|
14
|
+
black: "#1E1A1A",
|
|
15
|
+
brown: "#5A3825",
|
|
16
|
+
blonde: "#E2B45A",
|
|
17
|
+
red: "#B0462A",
|
|
18
|
+
gray: "#9C9C9C"
|
|
19
|
+
};
|
|
20
|
+
static AGE_TO_HAIR_COLOR = { elder: "gray" };
|
|
21
|
+
static STYLE_TO_BACK_EXTRA = {
|
|
22
|
+
long: (hair) => `<path d="M-11 -90 Q-13 -70 -9 -68 L9 -68 Q13 -70 11 -90 Z" fill="${hair}"/>`,
|
|
23
|
+
bun: (hair) => `<circle cx="0" cy="-104" r="6" fill="${hair}"/>`
|
|
24
|
+
};
|
|
25
|
+
static CENTER_Y = -91;
|
|
26
|
+
static CURL_OFFSETS = [[-9, -6], [-4, -10], [2, -11], [8, -8], [11, -2], [-11, 0]];
|
|
27
|
+
static STYLE_TO_HAIR = {
|
|
28
|
+
long: (hair) => ({
|
|
29
|
+
backHair: `<path d="M-12 -93 Q-15 -70 -10 -68 L10 -68 Q15 -70 12 -93 Z" fill="${hair}"/>`,
|
|
30
|
+
front: `<path d="M-12 -92 Q-11 -105 0 -104 Q11 -105 12 -92 Q4 -99 -12 -92 Z" fill="${hair}"/>`
|
|
31
|
+
}),
|
|
32
|
+
bun: (hair) => ({
|
|
33
|
+
backHair: `<circle cx="0" cy="-105" r="6" fill="${hair}"/>`,
|
|
34
|
+
front: PersonHeadUtil.fringe(hair)
|
|
35
|
+
}),
|
|
36
|
+
curly: (hair) => ({
|
|
37
|
+
backHair: "",
|
|
38
|
+
front: PersonHeadUtil.CURL_OFFSETS.map(([offsetX, offsetY]) => `<circle cx="${0 + offsetX}" cy="${PersonHeadUtil.CENTER_Y + offsetY}" r="5" fill="${hair}"/>`).join("")
|
|
39
|
+
}),
|
|
40
|
+
ponytail: (hair, side) => {
|
|
41
|
+
const flat = side ? 0 : 1;
|
|
42
|
+
return {
|
|
43
|
+
backHair: `<path d="M${-side * 9 - flat * 9} -96 Q${-side * 22 - flat * 14} -86 ${-side * 15 - flat * 12} -72" stroke="${hair}" stroke-width="6" fill="none" stroke-linecap="round"/>`,
|
|
44
|
+
front: PersonHeadUtil.fringe(hair)
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
short: (hair) => ({ backHair: "", front: PersonHeadUtil.shortFront(hair) }),
|
|
48
|
+
bald: () => ({ backHair: "", front: "" })
|
|
49
|
+
};
|
|
50
|
+
static EXPRESSION_TO_MOUTH = {
|
|
51
|
+
surprised: (centerX, centerY, ink) => `<ellipse cx="${centerX}" cy="${centerY + 5.5}" rx="1.6" ry="2" fill="${ink}"/>`,
|
|
52
|
+
neutral: (centerX, centerY, ink) => `<path d="M${centerX - 2.5} ${centerY + 5.5} L${centerX + 2.5} ${centerY + 5.5}" stroke="${ink}" stroke-width="1.2" stroke-linecap="round"/>`,
|
|
53
|
+
sad: (centerX, centerY, ink) => PersonHeadUtil.frown(centerX, centerY, ink),
|
|
54
|
+
worried: (centerX, centerY, ink) => PersonHeadUtil.frown(centerX, centerY, ink),
|
|
55
|
+
angry: (centerX, centerY, ink) => PersonHeadUtil.frown(centerX, centerY, ink),
|
|
56
|
+
laughing: (centerX, centerY, ink) => `<path d="M${centerX - 3.5} ${centerY + 4} Q${centerX} ${centerY + 9.5} ${centerX + 3.5} ${centerY + 4} Z" fill="${ink}"/>`
|
|
57
|
+
};
|
|
58
|
+
static EXPRESSION_TO_BROWS = {
|
|
59
|
+
thinking: (centerX, centerY, hair) => PersonHeadUtil.raisedBrows(centerX, centerY, hair),
|
|
60
|
+
surprised: (centerX, centerY, hair) => PersonHeadUtil.raisedBrows(centerX, centerY, hair),
|
|
61
|
+
worried: (centerX, centerY, hair) => `<path d="M${-6 + centerX} ${centerY - 4.2} L${-2 + centerX} ${centerY - 5.6} M${2 + centerX} ${centerY - 5.6} L${6 + centerX} ${centerY - 4.2}" stroke="${hair}" stroke-width="1.1" stroke-linecap="round"/>`,
|
|
62
|
+
angry: (centerX, centerY, hair) => `<path d="M${-6 + centerX} ${centerY - 5.6} L${-2 + centerX} ${centerY - 4} M${2 + centerX} ${centerY - 4} L${6 + centerX} ${centerY - 5.6}" stroke="${hair}" stroke-width="1.3" stroke-linecap="round"/>`
|
|
63
|
+
};
|
|
64
|
+
static shortFront(hair) {
|
|
65
|
+
return `<path d="M-11 -93 Q-10 -104 1 -103 Q11 -102 11 -94 Q6 -98 -2 -97 Q-7 -96 -11 -93 Z" fill="${hair}"/>`;
|
|
66
|
+
}
|
|
67
|
+
static fringe(hair) {
|
|
68
|
+
return `<path d="M-11.5 -92 Q-11 -104 0 -103.5 Q11 -104 11.5 -92 Q2 -100 -11.5 -92 Z" fill="${hair}"/>`;
|
|
69
|
+
}
|
|
70
|
+
static frown(centerX, centerY, ink) {
|
|
71
|
+
return `<path d="M${centerX - 3} ${centerY + 6.5} Q${centerX} ${centerY + 3.8} ${centerX + 3} ${centerY + 6.5}" stroke="${ink}" stroke-width="1.2" fill="none" stroke-linecap="round"/>`;
|
|
72
|
+
}
|
|
73
|
+
static smile(centerX, centerY, ink) {
|
|
74
|
+
return `<path d="M${centerX - 3} ${centerY + 4.5} Q${centerX} ${centerY + 7.5} ${centerX + 3} ${centerY + 4.5}" stroke="${ink}" stroke-width="1.2" fill="none" stroke-linecap="round"/>`;
|
|
75
|
+
}
|
|
76
|
+
static raisedBrows(centerX, centerY, hair) {
|
|
77
|
+
return `<path d="M${-6 + centerX} ${centerY - 4.5} L${-2 + centerX} ${centerY - 5.2} M${2 + centerX} ${centerY - 5.2} L${6 + centerX} ${centerY - 4.5}" stroke="${hair}" stroke-width="1.1" stroke-linecap="round"/>`;
|
|
78
|
+
}
|
|
79
|
+
static skinOf(name) {
|
|
80
|
+
return IdUtil.lookup(PersonHeadUtil.SKIN_NAME_TO_COLOR, name) ?? PersonHeadUtil.SKIN_NAME_TO_COLOR.medium;
|
|
81
|
+
}
|
|
82
|
+
static hairColorOf(params) {
|
|
83
|
+
const named = IdUtil.lookup(PersonHeadUtil.HAIR_NAME_TO_COLOR, params.hair_color);
|
|
84
|
+
const defaultName = IdUtil.lookup(PersonHeadUtil.AGE_TO_HAIR_COLOR, params.age) ?? "brown";
|
|
85
|
+
const fallback = PersonHeadUtil.HAIR_NAME_TO_COLOR[defaultName];
|
|
86
|
+
return named ?? FallbackUtil.nonEmpty(params.hair_color, fallback);
|
|
87
|
+
}
|
|
88
|
+
static head(params, theme, face) {
|
|
89
|
+
const { side, isBack, gaze } = face;
|
|
90
|
+
const skin = PersonHeadUtil.skinOf(params.skin);
|
|
91
|
+
const hair = PersonHeadUtil.hairColorOf(params);
|
|
92
|
+
const style = FallbackUtil.nonEmpty(params.hair, "short");
|
|
93
|
+
const builder = IdUtil.lookup(PersonHeadUtil.STYLE_TO_HAIR, style);
|
|
94
|
+
const { backHair, front } = builder?.(hair, side) ?? { backHair: "", front: "" };
|
|
95
|
+
const neck = `<rect x="-3" y="-85" width="6" height="7" fill="${ColorUtil.sh(skin, -0.12)}"/>`;
|
|
96
|
+
if (isBack) {
|
|
97
|
+
return neck + backHair + PersonHeadUtil.backOfHead(style, skin, hair);
|
|
98
|
+
}
|
|
99
|
+
const cy = PersonHeadUtil.CENTER_Y;
|
|
100
|
+
const earColor = ColorUtil.sh(skin, -0.08);
|
|
101
|
+
const ear = side ? `<ellipse cx="${-side * 10}" cy="${cy + 1}" rx="2" ry="3" fill="${earColor}"/>` : "";
|
|
102
|
+
return neck + backHair + ear + `<circle cx="0" cy="${cy}" r="11" fill="${skin}"/>` + front + PersonHeadUtil.faceFeatures(params, theme, { side, gaze, hair, skin });
|
|
103
|
+
}
|
|
104
|
+
static backOfHead(style, skin, hair) {
|
|
105
|
+
const cy = PersonHeadUtil.CENTER_Y;
|
|
106
|
+
const scalp = `<circle cx="0" cy="${cy}" r="11" fill="${skin}"/>`;
|
|
107
|
+
if (style === "bald") {
|
|
108
|
+
return scalp;
|
|
109
|
+
}
|
|
110
|
+
const extra = IdUtil.lookup(PersonHeadUtil.STYLE_TO_BACK_EXTRA, style)?.(hair) ?? "";
|
|
111
|
+
const cap = `<path d="M-11.3 -88 Q-12 -103 0 -103 Q12 -103 11.3 -88 Q0 -84 -11.3 -88 Z" fill="${hair}"/>`;
|
|
112
|
+
return `${scalp}${cap}${extra}`;
|
|
113
|
+
}
|
|
114
|
+
static faceFeatures(params, theme, look) {
|
|
115
|
+
const { side, gaze, hair, skin } = look;
|
|
116
|
+
const cy = PersonHeadUtil.CENTER_Y;
|
|
117
|
+
const expression = FallbackUtil.nonEmpty(params.expr, "happy");
|
|
118
|
+
const shiftX = side * 1.8 + (side ? 0 : gaze[0] * 1.3);
|
|
119
|
+
const mouthX = side * 2 + (side ? 0 : gaze[0] * 1.3);
|
|
120
|
+
const drawMouth = IdUtil.lookup(PersonHeadUtil.EXPRESSION_TO_MOUTH, expression);
|
|
121
|
+
const mouth = drawMouth ? drawMouth(mouthX, cy, theme.ink) : PersonHeadUtil.smile(mouthX, cy, theme.ink);
|
|
122
|
+
const brows = IdUtil.lookup(PersonHeadUtil.EXPRESSION_TO_BROWS, expression)?.(shiftX, cy, hair) ?? "";
|
|
123
|
+
const blush = `<circle cx="${-6.5 + shiftX}" cy="${cy + 3.5}" r="2" fill="#E9806E" opacity="0.35"/><circle cx="${6.5 + shiftX}" cy="${cy + 3.5}" r="2" fill="#E9806E" opacity="0.35"/>`;
|
|
124
|
+
const glasses = params.glasses ? `<g stroke="${theme.ink}" stroke-width="1" fill="none"><circle cx="${-4 + shiftX}" cy="${cy}" r="3.2"/><circle cx="${4 + shiftX}" cy="${cy}" r="3.2"/><path d="M${-0.8 + shiftX} ${cy} L${0.8 + shiftX} ${cy}"/></g>` : "";
|
|
125
|
+
const beard = params.beard ? `<path d="M-10 -89 Q-10 -76 0 -76 Q10 -76 10 -89 Q8 -83 ${mouthX + 4} ${cy + 3} L${mouthX - 4} ${cy + 3} Q-8 -83 -10 -89 Z" fill="${hair}"/>` : "";
|
|
126
|
+
const lines = PersonHeadUtil.ageLines(params, skin, shiftX);
|
|
127
|
+
const eyes = PersonHeadUtil.eyes(expression, theme, { shiftX, gaze });
|
|
128
|
+
return beard + lines + eyes + brows + mouth + blush + glasses;
|
|
129
|
+
}
|
|
130
|
+
static ageLines(params, skin, shiftX) {
|
|
131
|
+
if (params.age !== "elder") {
|
|
132
|
+
return "";
|
|
133
|
+
}
|
|
134
|
+
const round = (value) => PersonArmUtil.round(value);
|
|
135
|
+
const cy = PersonHeadUtil.CENTER_Y;
|
|
136
|
+
const stroke = ColorUtil.sh(skin, -0.25);
|
|
137
|
+
return `<path d="M${round(-8.2 + shiftX)} ${cy - 1.5} l-1.4 -0.6 M${round(8.2 + shiftX)} ${cy - 1.5} l1.4 -0.6 M${round(-5 + shiftX)} ${cy - 7.5} L${round(5 + shiftX)} ${cy - 7.5}" stroke="${stroke}" stroke-width="0.6" stroke-linecap="round"/>`;
|
|
138
|
+
}
|
|
139
|
+
static eyes(expression, theme, look) {
|
|
140
|
+
const round = (value) => PersonArmUtil.round(value);
|
|
141
|
+
const { shiftX, gaze } = look;
|
|
142
|
+
const cy = PersonHeadUtil.CENTER_Y;
|
|
143
|
+
const pupilX = gaze[0] * 1.1;
|
|
144
|
+
const pupilY = gaze[1] * 1.1;
|
|
145
|
+
const eye = (column) => `<circle cx="${round(column + pupilX)}" cy="${round(cy + pupilY)}" r="1.45" fill="${theme.ink}"/><circle cx="${round(column + pupilX + 0.45)}" cy="${round(cy + pupilY - 0.5)}" r="0.42" fill="#FFFFFF" opacity="0.85"/>`;
|
|
146
|
+
if (expression === "wink") {
|
|
147
|
+
return eye(-4 + shiftX) + `<path d="M${round(2.4 + shiftX)} ${cy} Q${round(4 + shiftX)} ${cy - 1.6} ${round(5.6 + shiftX)} ${cy}" stroke="${theme.ink}" stroke-width="1.1" fill="none" stroke-linecap="round"/>`;
|
|
148
|
+
}
|
|
149
|
+
return eye(-4 + shiftX) + eye(4 + shiftX);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
export {
|
|
153
|
+
PersonHeadUtil
|
|
154
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { BottomName, OutfitName, PersonParams } from "../Protocols/PersonProtocol.js";
|
|
2
|
+
import type { Theme } from "../Protocols/ThemeProtocol.js";
|
|
3
|
+
export interface PersonLook {
|
|
4
|
+
theme: Theme;
|
|
5
|
+
skin: string;
|
|
6
|
+
top: string;
|
|
7
|
+
bottomColor: string;
|
|
8
|
+
jacket: string | null;
|
|
9
|
+
outfit: OutfitName | null;
|
|
10
|
+
bottom: BottomName | null;
|
|
11
|
+
shoes: string;
|
|
12
|
+
gown: string | null;
|
|
13
|
+
sleeve: string;
|
|
14
|
+
isShortSleeve: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare class PersonOutfitUtil {
|
|
17
|
+
private static readonly LAB_COAT;
|
|
18
|
+
private static readonly HAT_NAME_TO_BUILDER;
|
|
19
|
+
private static readonly OUTFIT_TO_TRAITS;
|
|
20
|
+
private static readonly BOTTOM_TO_LEG_SHAPE;
|
|
21
|
+
private static readonly UNKNOWN_LEG_SHAPE;
|
|
22
|
+
private static readonly OUTFIT_TO_NECKLINE;
|
|
23
|
+
private static readonly BOTTOM_TO_SEATED_OVERLAY;
|
|
24
|
+
private static readonly BOTTOM_TO_STANDING_OVERLAY;
|
|
25
|
+
private static colorOf;
|
|
26
|
+
private static themeColorOnly;
|
|
27
|
+
static lookOf(params: PersonParams, theme: Theme): PersonLook;
|
|
28
|
+
private static legShapeOf;
|
|
29
|
+
private static legColorOf;
|
|
30
|
+
static seatedLegs(look: PersonLook, facing: number): string;
|
|
31
|
+
private static seatedSkirt;
|
|
32
|
+
static seatedTorso(look: PersonLook, facing: number): string;
|
|
33
|
+
static standingLegs(look: PersonLook, isWalking: boolean): string;
|
|
34
|
+
private static walkingLegs;
|
|
35
|
+
private static restingLegs;
|
|
36
|
+
static standingTorso(look: PersonLook, params: PersonParams, isBack: boolean): string;
|
|
37
|
+
private static baseTorso;
|
|
38
|
+
private static upperLayers;
|
|
39
|
+
private static gownLayer;
|
|
40
|
+
private static labCoatLayer;
|
|
41
|
+
static backpack(look: PersonLook, params: PersonParams, isBack: boolean): {
|
|
42
|
+
behind: string;
|
|
43
|
+
onTorso: string;
|
|
44
|
+
};
|
|
45
|
+
static hat(look: PersonLook, params: PersonParams, side: number): string;
|
|
46
|
+
private static graduationCap;
|
|
47
|
+
private static cap;
|
|
48
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { BOTTOM_NAMES, OUTFIT_NAMES } from "../Protocols/PersonProtocol.js";
|
|
2
|
+
import { ColorUtil } from "./ColorUtil.js";
|
|
3
|
+
import { FallbackUtil } from "./FallbackUtil.js";
|
|
4
|
+
import { IdUtil } from "./IdUtil.js";
|
|
5
|
+
import { PersonHeadUtil } from "./PersonHeadUtil.js";
|
|
6
|
+
class PersonOutfitUtil {
|
|
7
|
+
static LAB_COAT = "#FBFBF8";
|
|
8
|
+
static HAT_NAME_TO_BUILDER = {
|
|
9
|
+
grad_cap: (look) => PersonOutfitUtil.graduationCap(look),
|
|
10
|
+
cap: (look, params, side) => PersonOutfitUtil.cap(look, params, side)
|
|
11
|
+
};
|
|
12
|
+
static OUTFIT_TO_TRAITS = {
|
|
13
|
+
tshirt: { hasGown: false, isDress: false, isLabCoat: false, isTshirt: true },
|
|
14
|
+
sweater: { hasGown: false, isDress: false, isLabCoat: false, isTshirt: false },
|
|
15
|
+
labcoat: { hasGown: false, isDress: false, isLabCoat: true, isTshirt: false },
|
|
16
|
+
gown: { hasGown: true, isDress: false, isLabCoat: false, isTshirt: false },
|
|
17
|
+
dress: { hasGown: false, isDress: true, isLabCoat: false, isTshirt: false }
|
|
18
|
+
};
|
|
19
|
+
static BOTTOM_TO_LEG_SHAPE = {
|
|
20
|
+
pants: { width: 8, isCovered: true },
|
|
21
|
+
shorts: { width: 6.5, isCovered: false },
|
|
22
|
+
skirt: { width: 6.5, isCovered: false },
|
|
23
|
+
dress: { width: 6.5, isCovered: false }
|
|
24
|
+
};
|
|
25
|
+
static UNKNOWN_LEG_SHAPE = { width: 6.5, isCovered: false };
|
|
26
|
+
static OUTFIT_TO_NECKLINE = {
|
|
27
|
+
sweater: (look) => `<path d="M-6 -81 Q0 -76 6 -81" stroke="${ColorUtil.sh(look.top, -0.25)}" stroke-width="1.5" fill="none"/>`,
|
|
28
|
+
tshirt: (look) => `<path d="M-5 -81 Q0 -77 5 -81" fill="${ColorUtil.sh(look.skin, -0.12)}"/>`
|
|
29
|
+
};
|
|
30
|
+
static BOTTOM_TO_SEATED_OVERLAY = {
|
|
31
|
+
shorts: (look, facing) => `<path d="M0 -45 L${facing * 14} -45" stroke="${look.bottomColor}" stroke-width="12" stroke-linecap="butt"/>`,
|
|
32
|
+
skirt: (look, facing) => PersonOutfitUtil.seatedSkirt(look, facing, look.bottomColor),
|
|
33
|
+
dress: (look, facing) => PersonOutfitUtil.seatedSkirt(look, facing, look.top)
|
|
34
|
+
};
|
|
35
|
+
static BOTTOM_TO_STANDING_OVERLAY = {
|
|
36
|
+
shorts: (look) => `<path d="M-11 -47 L11 -47 L12 -30 L1 -30 L0 -36 L-1 -30 L-12 -30 Z" fill="${look.bottomColor}"/><path d="M4 -47 L11 -47 L12 -30 L5 -30 Z" fill="${ColorUtil.sh(look.bottomColor, -0.12)}"/>`,
|
|
37
|
+
skirt: (look) => `<path d="M-12 -48 L12 -48 L17 -27 L-17 -27 Z" fill="${look.bottomColor}"/><path d="M4 -48 L12 -48 L17 -27 L7 -27 Z" fill="${ColorUtil.sh(look.bottomColor, -0.12)}"/>`,
|
|
38
|
+
dress: (look) => `<path d="M-12 -48 L12 -48 L18 -24 L-18 -24 Z" fill="${look.top}"/><path d="M4 -48 L12 -48 L18 -24 L7 -24 Z" fill="${ColorUtil.sh(look.top, -0.12)}"/>`
|
|
39
|
+
};
|
|
40
|
+
static colorOf(theme, name, fallback) {
|
|
41
|
+
if (!name) {
|
|
42
|
+
return fallback;
|
|
43
|
+
}
|
|
44
|
+
const value = theme[name];
|
|
45
|
+
return typeof value === "string" && value ? value : name;
|
|
46
|
+
}
|
|
47
|
+
static themeColorOnly(theme, name, fallback) {
|
|
48
|
+
const value = name ? theme[name] : void 0;
|
|
49
|
+
return typeof value === "string" && value ? value : fallback;
|
|
50
|
+
}
|
|
51
|
+
static lookOf(params, theme) {
|
|
52
|
+
const top = PersonOutfitUtil.colorOf(theme, params.shirt, theme.primary);
|
|
53
|
+
const jacket = params.jacket ? PersonOutfitUtil.colorOf(theme, params.jacket, "") : null;
|
|
54
|
+
const outfitText = FallbackUtil.nonEmpty(params.outfit, "tshirt");
|
|
55
|
+
const outfit = IdUtil.isOneOf(OUTFIT_NAMES, outfitText) ? outfitText : null;
|
|
56
|
+
const traits = IdUtil.lookup(PersonOutfitUtil.OUTFIT_TO_TRAITS, outfit);
|
|
57
|
+
const gown = traits?.hasGown ? PersonOutfitUtil.colorOf(theme, params.gown, theme.ink) : null;
|
|
58
|
+
const bottomText = traits?.isDress ? "dress" : FallbackUtil.nonEmpty(params.bottom, "pants");
|
|
59
|
+
return {
|
|
60
|
+
theme,
|
|
61
|
+
skin: PersonHeadUtil.skinOf(params.skin),
|
|
62
|
+
top,
|
|
63
|
+
bottomColor: PersonOutfitUtil.colorOf(theme, params.pants, theme.secondary),
|
|
64
|
+
jacket,
|
|
65
|
+
outfit,
|
|
66
|
+
bottom: IdUtil.isOneOf(BOTTOM_NAMES, bottomText) ? bottomText : null,
|
|
67
|
+
shoes: PersonOutfitUtil.colorOf(theme, params.shoes, theme.ink),
|
|
68
|
+
gown,
|
|
69
|
+
sleeve: traits?.isLabCoat ? PersonOutfitUtil.LAB_COAT : gown ?? jacket ?? top,
|
|
70
|
+
isShortSleeve: !jacket && traits?.isTshirt === true
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
static legShapeOf(look) {
|
|
74
|
+
return IdUtil.lookup(PersonOutfitUtil.BOTTOM_TO_LEG_SHAPE, look.bottom) ?? PersonOutfitUtil.UNKNOWN_LEG_SHAPE;
|
|
75
|
+
}
|
|
76
|
+
static legColorOf(look) {
|
|
77
|
+
return PersonOutfitUtil.legShapeOf(look).isCovered ? look.bottomColor : look.skin;
|
|
78
|
+
}
|
|
79
|
+
static seatedLegs(look, facing) {
|
|
80
|
+
const { shoes } = look;
|
|
81
|
+
const legColor = PersonOutfitUtil.legColorOf(look);
|
|
82
|
+
const legs = `<path d="M0 -45 L${facing * 24} -45 L${facing * 24} -4" stroke="${legColor}" stroke-width="11" fill="none" stroke-linejoin="round"/><path d="M${facing * 2} -41 L${facing * 24} -41" stroke="${ColorUtil.sh(legColor, -0.12)}" stroke-width="3" fill="none"/><path d="M${facing * 21} -3 L${facing * 32} -3 Q${facing * 32} -8 ${facing * 25} -8 L${facing * 21} -8 Z" fill="${shoes}"/>`;
|
|
83
|
+
return legs + (IdUtil.lookup(PersonOutfitUtil.BOTTOM_TO_SEATED_OVERLAY, look.bottom)?.(look, facing) ?? "");
|
|
84
|
+
}
|
|
85
|
+
static seatedSkirt(look, facing, fill) {
|
|
86
|
+
return `<path d="M${-facing * 6} -52 L${facing * 18} -50 L${facing * 20} -39 L${-facing * 7} -40 Z" fill="${fill}"/>`;
|
|
87
|
+
}
|
|
88
|
+
static seatedTorso(look, facing) {
|
|
89
|
+
const { jacket, top } = look;
|
|
90
|
+
const torsoColor = jacket ?? top;
|
|
91
|
+
return `<rect x="-10" y="-81" width="20" height="40" rx="7" fill="${torsoColor}"/><path d="M${-facing * 10} -74 Q${-facing * 10} -81 ${-facing * 4} -81 L${-facing * 3} -81 L${-facing * 3} -41 L${-facing * 10} -41 Z" fill="${ColorUtil.sh(torsoColor, -0.13)}"/>` + (jacket ? `<path d="M${facing * 5} -80 L${facing * 9} -76 L${facing * 9} -44 L${facing * 4} -44 Z" fill="${top}"/>` : "");
|
|
92
|
+
}
|
|
93
|
+
static standingLegs(look, isWalking) {
|
|
94
|
+
const { shoes } = look;
|
|
95
|
+
const legColor = PersonOutfitUtil.legColorOf(look);
|
|
96
|
+
const legWidth = PersonOutfitUtil.legShapeOf(look).width;
|
|
97
|
+
const legs = isWalking ? PersonOutfitUtil.walkingLegs(legColor, shoes) : PersonOutfitUtil.restingLegs(legColor, shoes, legWidth);
|
|
98
|
+
return legs + (IdUtil.lookup(PersonOutfitUtil.BOTTOM_TO_STANDING_OVERLAY, look.bottom)?.(look) ?? "");
|
|
99
|
+
}
|
|
100
|
+
static walkingLegs(legColor, shoes) {
|
|
101
|
+
return `<path d="M-3 -45 L-12 -3" stroke="${legColor}" stroke-width="8" stroke-linecap="round"/><path d="M3 -45 L11 -3" stroke="${ColorUtil.sh(legColor, -0.12)}" stroke-width="8" stroke-linecap="round"/><ellipse cx="-14" cy="-2.5" rx="5.5" ry="2.8" fill="${shoes}"/><ellipse cx="14" cy="-2.5" rx="5.5" ry="2.8" fill="${shoes}"/>`;
|
|
102
|
+
}
|
|
103
|
+
static restingLegs(legColor, shoes, legWidth) {
|
|
104
|
+
return `<rect x="${-1 - legWidth}" y="-47" width="${legWidth}" height="45" rx="3" fill="${legColor}"/><rect x="1" y="-47" width="${legWidth}" height="45" rx="3" fill="${legColor}"/><rect x="${1 + legWidth * 0.45}" y="-47" width="${legWidth * 0.55}" height="45" rx="2" fill="${ColorUtil.sh(legColor, -0.12)}"/><ellipse cx="-5.5" cy="-2.5" rx="5.5" ry="2.8" fill="${shoes}"/><ellipse cx="5.5" cy="-2.5" rx="5.5" ry="2.8" fill="${shoes}"/>`;
|
|
105
|
+
}
|
|
106
|
+
static standingTorso(look, params, isBack) {
|
|
107
|
+
return PersonOutfitUtil.baseTorso(look, params.build === "heavy") + PersonOutfitUtil.upperLayers(look, isBack) + PersonOutfitUtil.gownLayer(look, params, isBack) + PersonOutfitUtil.labCoatLayer(look, isBack);
|
|
108
|
+
}
|
|
109
|
+
static baseTorso(look, isHeavy) {
|
|
110
|
+
const torsoColor = look.jacket ?? look.top;
|
|
111
|
+
const shade = ColorUtil.sh(torsoColor, -0.13);
|
|
112
|
+
if (isHeavy) {
|
|
113
|
+
return `<path d="M-13 -74 Q-13 -81 -6 -81 L6 -81 Q13 -81 13 -74 Q18 -58 13 -44 L-13 -44 Q-18 -58 -13 -74 Z" fill="${torsoColor}"/><path d="M5 -81 L6 -81 Q13 -81 13 -74 Q18 -58 13 -44 L5 -44 Z" fill="${shade}"/>`;
|
|
114
|
+
}
|
|
115
|
+
return `<path d="M-13 -74 Q-13 -81 -6 -81 L6 -81 Q13 -81 13 -74 L12 -44 L-12 -44 Z" fill="${torsoColor}"/><path d="M5 -81 L6 -81 Q13 -81 13 -74 L12 -44 L5 -44 Z" fill="${shade}"/>`;
|
|
116
|
+
}
|
|
117
|
+
static upperLayers(look, isBack) {
|
|
118
|
+
const { jacket, top } = look;
|
|
119
|
+
if (isBack) {
|
|
120
|
+
return "";
|
|
121
|
+
}
|
|
122
|
+
if (jacket) {
|
|
123
|
+
return `<path d="M-5 -81 L5 -81 L3 -45 L-3 -45 Z" fill="${top}"/><path d="M-5 -81 L-1 -70 L-4 -60 M5 -81 L1 -70 L4 -60" stroke="${ColorUtil.sh(jacket, -0.25)}" stroke-width="1.2" fill="none"/>`;
|
|
124
|
+
}
|
|
125
|
+
return IdUtil.lookup(PersonOutfitUtil.OUTFIT_TO_NECKLINE, look.outfit)?.(look) ?? "";
|
|
126
|
+
}
|
|
127
|
+
static gownLayer(look, params, isBack) {
|
|
128
|
+
const { gown, theme, skin } = look;
|
|
129
|
+
if (!gown) {
|
|
130
|
+
return "";
|
|
131
|
+
}
|
|
132
|
+
const stole = PersonOutfitUtil.themeColorOnly(theme, params.stole, theme.accent);
|
|
133
|
+
const front = `<path d="M-6 -81 L-3 -81 L-4 -46 L-7 -46 Z M3 -81 L6 -81 L7 -46 L4 -46 Z" fill="${stole}"/><path d="M-5 -81 Q0 -74 5 -81" fill="${ColorUtil.sh(skin, -0.12)}"/>`;
|
|
134
|
+
return `<path d="M-13 -76 Q-13 -81 -6 -81 L6 -81 Q13 -81 13 -76 L18 -14 L-18 -14 Z" fill="${gown}"/><path d="M5 -81 L6 -81 Q13 -81 13 -76 L18 -14 L6 -14 Z" fill="${ColorUtil.sh(gown, -0.15)}"/>` + (isBack ? "" : front);
|
|
135
|
+
}
|
|
136
|
+
static labCoatLayer(look, isBack) {
|
|
137
|
+
if (look.outfit !== "labcoat") {
|
|
138
|
+
return "";
|
|
139
|
+
}
|
|
140
|
+
const coat = PersonOutfitUtil.LAB_COAT;
|
|
141
|
+
const { top, theme } = look;
|
|
142
|
+
const seam = ColorUtil.sh(coat, -0.25);
|
|
143
|
+
const front = `<path d="M-5 -81 L5 -81 L1 -60 L-1 -60 Z" fill="${top}"/><path d="M0 -60 L0 -27" stroke="${seam}" stroke-width="1"/><rect x="-11" y="-42" width="7" height="6" rx="1" fill="none" stroke="${seam}" stroke-width="1"/><path d="M6 -72 L6 -66" stroke="${theme.primary}" stroke-width="1.6"/>`;
|
|
144
|
+
return `<path d="M-13 -76 Q-13 -81 -6 -81 L6 -81 Q13 -81 13 -76 L15 -27 L-15 -27 Z" fill="${coat}"/><path d="M5 -81 L6 -81 Q13 -81 13 -76 L15 -27 L5 -27 Z" fill="${ColorUtil.sh(coat, -0.1)}"/>` + (isBack ? "" : front);
|
|
145
|
+
}
|
|
146
|
+
static backpack(look, params, isBack) {
|
|
147
|
+
if (!params.backpack) {
|
|
148
|
+
return { behind: "", onTorso: "" };
|
|
149
|
+
}
|
|
150
|
+
const { theme } = look;
|
|
151
|
+
const color = params.backpack === true ? theme.accent : PersonOutfitUtil.colorOf(theme, params.backpack, theme.accent);
|
|
152
|
+
if (isBack) {
|
|
153
|
+
return {
|
|
154
|
+
behind: "",
|
|
155
|
+
onTorso: `<rect x="-11" y="-78" width="22" height="30" rx="7" fill="${color}"/><rect x="-7" y="-62" width="14" height="10" rx="3" fill="${ColorUtil.sh(color, -0.15)}"/>`
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
return {
|
|
159
|
+
behind: `<rect x="-16" y="-79" width="32" height="32" rx="7" fill="${ColorUtil.sh(color, -0.2)}"/>`,
|
|
160
|
+
onTorso: `<path d="M-8 -81 L-9 -50 M8 -81 L9 -50" stroke="${ColorUtil.sh(color, -0.1)}" stroke-width="2.5" stroke-linecap="round"/>`
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
static hat(look, params, side) {
|
|
164
|
+
return IdUtil.lookup(PersonOutfitUtil.HAT_NAME_TO_BUILDER, params.hat)?.(look, params, side) ?? "";
|
|
165
|
+
}
|
|
166
|
+
static graduationCap(look) {
|
|
167
|
+
const { ink, accent } = look.theme;
|
|
168
|
+
return `<path d="M-9 -103 L9 -103 L9 -98 Q0 -95 -9 -98 Z" fill="${ink}"/><path d="M-18 -103 L0 -110 L18 -103 L0 -96 Z" fill="${ink}"/><path d="M-18 -103 L0 -96 L18 -103 L0 -98.5 Z" fill="${ColorUtil.sh(ink, 0.15)}"/><path d="M0 -103 L13 -102 L14 -93" stroke="${accent}" stroke-width="1.3" fill="none"/><circle cx="14" cy="-92" r="1.8" fill="${accent}"/>`;
|
|
169
|
+
}
|
|
170
|
+
static cap(look, params, side) {
|
|
171
|
+
const color = PersonOutfitUtil.themeColorOnly(look.theme, params.hat_color, look.theme.primary);
|
|
172
|
+
const isFacingRight = side >= 0;
|
|
173
|
+
return `<path d="M-11 -97 Q-11 -108 0 -108 Q11 -108 11 -97 Z" fill="${color}"/><path d="M${isFacingRight ? 4 : -18} -98 L${isFacingRight ? 18 : -4} -98 L${isFacingRight ? 16 : -6} -95 L${isFacingRight ? 4 : -4} -95 Z" fill="${ColorUtil.sh(color, -0.2)}"/>`;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
export {
|
|
177
|
+
PersonOutfitUtil
|
|
178
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { AssetDrawing } from "../Protocols/AssetProtocol.js";
|
|
2
|
+
import { type BodyScale, type PersonParams } from "../Protocols/PersonProtocol.js";
|
|
3
|
+
import type { Theme } from "../Protocols/ThemeProtocol.js";
|
|
4
|
+
export declare class PersonUtil {
|
|
5
|
+
static readonly EXPRESSION_NAMES: ("angry" | "happy" | "laughing" | "neutral" | "sad" | "surprised" | "thinking" | "wink" | "worried")[];
|
|
6
|
+
private static readonly POSE_NAME_TO_FRONT_POSE;
|
|
7
|
+
private static readonly STANDING_POSE;
|
|
8
|
+
private static readonly POSE_NAME_TO_SIDE_HANDS;
|
|
9
|
+
private static readonly TYPING_HANDS;
|
|
10
|
+
static readonly POSE_NAMES: {
|
|
11
|
+
standing: ("celebrating" | "hands_on_hips" | "holding" | "phone" | "pointing" | "presenting" | "shrugging" | "standing" | "thinking" | "walking" | "waving")[];
|
|
12
|
+
seated: ("drinking" | "reading" | "sitting" | "typing")[];
|
|
13
|
+
};
|
|
14
|
+
private static readonly AGE_TO_SCALE;
|
|
15
|
+
private static readonly ADULT_SCALE;
|
|
16
|
+
private static readonly BUILD_TO_WIDTH;
|
|
17
|
+
private static readonly MIN_HEIGHT;
|
|
18
|
+
private static readonly MAX_HEIGHT;
|
|
19
|
+
private static readonly LOOK_TO_GAZE;
|
|
20
|
+
private static readonly POSE_TO_GAZE;
|
|
21
|
+
private static readonly FACING_TO_SIDE;
|
|
22
|
+
private static readonly POSE_TO_SEATED_PROP;
|
|
23
|
+
private static readonly SEATED_HEAD_TILT;
|
|
24
|
+
private static readonly STANDING_HEAD_TILT;
|
|
25
|
+
private static readonly FRONT_HEAD_TILT;
|
|
26
|
+
private static readonly CANE_REST_HEIGHT;
|
|
27
|
+
static bodyScale(params?: PersonParams): BodyScale;
|
|
28
|
+
private static gazeOf;
|
|
29
|
+
static person(params: PersonParams, theme: Theme): AssetDrawing;
|
|
30
|
+
private static bodyGroup;
|
|
31
|
+
private static headGroup;
|
|
32
|
+
private static seated;
|
|
33
|
+
private static seatedProp;
|
|
34
|
+
private static book;
|
|
35
|
+
private static cup;
|
|
36
|
+
private static standing;
|
|
37
|
+
private static cane;
|
|
38
|
+
private static phone;
|
|
39
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { ColorUtil } from "./ColorUtil.js";
|
|
2
|
+
import {
|
|
3
|
+
EXPRESSION_NAMES,
|
|
4
|
+
SEATED_POSE_NAMES,
|
|
5
|
+
STANDING_POSE_NAMES
|
|
6
|
+
} from "../Protocols/PersonProtocol.js";
|
|
7
|
+
import { FallbackUtil } from "./FallbackUtil.js";
|
|
8
|
+
import { IdUtil } from "./IdUtil.js";
|
|
9
|
+
import { PersonArmUtil } from "./PersonArmUtil.js";
|
|
10
|
+
import { PersonHeadUtil } from "./PersonHeadUtil.js";
|
|
11
|
+
import { PersonOutfitUtil } from "./PersonOutfitUtil.js";
|
|
12
|
+
class PersonUtil {
|
|
13
|
+
static EXPRESSION_NAMES = [...EXPRESSION_NAMES];
|
|
14
|
+
// Why: units are such that a standing person is 100 tall with the origin at the feet; poses only say where the hands go.
|
|
15
|
+
static POSE_NAME_TO_FRONT_POSE = {
|
|
16
|
+
standing: { left: [-15, -46], right: [15, -46] },
|
|
17
|
+
waving: { left: [-15, -46], right: [27, -105], isRightOpen: true },
|
|
18
|
+
pointing: { left: [-15, -46], right: [46, -77] },
|
|
19
|
+
presenting: { left: [-15, -46], right: [36, -66], isRightOpen: true, bendRight: "down" },
|
|
20
|
+
celebrating: { left: [-24, -108], right: [24, -108], isLeftOpen: true, isRightOpen: true },
|
|
21
|
+
holding: { left: [-15, -46], right: [21, -57] },
|
|
22
|
+
hands_on_hips: { left: [-12, -50], right: [12, -50] },
|
|
23
|
+
thinking: { left: [-7, -57], right: [5, -82], bendRight: "down" },
|
|
24
|
+
shrugging: { left: [-27, -66], right: [27, -66], isLeftOpen: true, isRightOpen: true },
|
|
25
|
+
walking: { left: [-8, -49], right: [19, -51] },
|
|
26
|
+
phone: { left: [-15, -46], right: [10, -88] }
|
|
27
|
+
};
|
|
28
|
+
static STANDING_POSE = { left: [-15, -46], right: [15, -46] };
|
|
29
|
+
static POSE_NAME_TO_SIDE_HANDS = {
|
|
30
|
+
sitting: [20, -50],
|
|
31
|
+
typing: [35, -55],
|
|
32
|
+
reading: [22, -66],
|
|
33
|
+
drinking: [10, -82]
|
|
34
|
+
};
|
|
35
|
+
static TYPING_HANDS = [35, -55];
|
|
36
|
+
static POSE_NAMES = { standing: [...STANDING_POSE_NAMES], seated: [...SEATED_POSE_NAMES] };
|
|
37
|
+
static AGE_TO_SCALE = {
|
|
38
|
+
child: { bx: 0.8, by: 0.58, hs: 0.93 },
|
|
39
|
+
teen: { bx: 0.9, by: 0.86, hs: 0.97 },
|
|
40
|
+
adult: { bx: 1, by: 1, hs: 1 },
|
|
41
|
+
elder: { bx: 1, by: 0.95, hs: 1 }
|
|
42
|
+
};
|
|
43
|
+
static ADULT_SCALE = { bx: 1, by: 1, hs: 1 };
|
|
44
|
+
static BUILD_TO_WIDTH = {
|
|
45
|
+
slim: 0.88,
|
|
46
|
+
average: 1,
|
|
47
|
+
broad: 1.12,
|
|
48
|
+
heavy: 1.16
|
|
49
|
+
};
|
|
50
|
+
static MIN_HEIGHT = 0.8;
|
|
51
|
+
static MAX_HEIGHT = 1.2;
|
|
52
|
+
static LOOK_TO_GAZE = {
|
|
53
|
+
"left": [-1, 0],
|
|
54
|
+
"right": [1, 0],
|
|
55
|
+
"up": [0, -1],
|
|
56
|
+
"down": [0, 1],
|
|
57
|
+
"up-left": [-0.8, -0.7],
|
|
58
|
+
"up-right": [0.8, -0.7],
|
|
59
|
+
"down-left": [-0.8, 0.7],
|
|
60
|
+
"down-right": [0.8, 0.7],
|
|
61
|
+
"camera": [0, 0],
|
|
62
|
+
"forward": [0, 0]
|
|
63
|
+
};
|
|
64
|
+
static POSE_TO_GAZE = {
|
|
65
|
+
pointing: [1, -0.3],
|
|
66
|
+
presenting: [0.8, 0],
|
|
67
|
+
thinking: [-0.5, -0.8],
|
|
68
|
+
celebrating: [0, -0.5],
|
|
69
|
+
phone: [0.5, 0.4],
|
|
70
|
+
holding: [0.5, 0.3],
|
|
71
|
+
reading: [0.5, 0.9],
|
|
72
|
+
typing: [1, 0.15],
|
|
73
|
+
drinking: [0.6, 0],
|
|
74
|
+
sitting: [0.6, 0]
|
|
75
|
+
};
|
|
76
|
+
static FACING_TO_SIDE = { left: -1, right: 1 };
|
|
77
|
+
static POSE_TO_SEATED_PROP = {
|
|
78
|
+
reading: (hand, facing, theme) => PersonUtil.book(hand, facing, theme),
|
|
79
|
+
drinking: (hand, facing, theme) => PersonUtil.cup(hand, facing, theme)
|
|
80
|
+
};
|
|
81
|
+
static SEATED_HEAD_TILT = 7;
|
|
82
|
+
static STANDING_HEAD_TILT = 6;
|
|
83
|
+
static FRONT_HEAD_TILT = 4;
|
|
84
|
+
static CANE_REST_HEIGHT = 6;
|
|
85
|
+
static bodyScale(params = {}) {
|
|
86
|
+
const age = IdUtil.lookup(PersonUtil.AGE_TO_SCALE, params.age) ?? PersonUtil.ADULT_SCALE;
|
|
87
|
+
const requested = Number(params.height) || 1;
|
|
88
|
+
const heightFactor = Math.max(PersonUtil.MIN_HEIGHT, Math.min(PersonUtil.MAX_HEIGHT, requested));
|
|
89
|
+
const width = IdUtil.lookup(PersonUtil.BUILD_TO_WIDTH, params.build) ?? 1;
|
|
90
|
+
return { bx: age.bx * width, by: age.by * heightFactor, hs: age.hs };
|
|
91
|
+
}
|
|
92
|
+
static gazeOf(params, pose, facing = 1) {
|
|
93
|
+
if (Array.isArray(params.gaze)) {
|
|
94
|
+
return [params.gaze[0] ?? 0, params.gaze[1] ?? 0];
|
|
95
|
+
}
|
|
96
|
+
const named = IdUtil.lookup(PersonUtil.LOOK_TO_GAZE, params.look);
|
|
97
|
+
if (named) {
|
|
98
|
+
return named;
|
|
99
|
+
}
|
|
100
|
+
const byPose = IdUtil.lookup(PersonUtil.POSE_TO_GAZE, pose);
|
|
101
|
+
return byPose ? [byPose[0] * facing, byPose[1]] : [0, 0];
|
|
102
|
+
}
|
|
103
|
+
static person(params, theme) {
|
|
104
|
+
const look = PersonOutfitUtil.lookOf(params, theme);
|
|
105
|
+
const scale = PersonUtil.bodyScale(params);
|
|
106
|
+
const pose = FallbackUtil.nonEmpty(params.pose, "standing");
|
|
107
|
+
const round = (value) => PersonArmUtil.round(value);
|
|
108
|
+
const shadow = `<ellipse cx="0" cy="0" rx="${round(20 * scale.bx)}" ry="3.2" fill="${theme.shadow}"/>`;
|
|
109
|
+
const isSeated = IdUtil.isOneOf(SEATED_POSE_NAMES, pose) || pose === "sitting_typing";
|
|
110
|
+
const drawn = isSeated ? PersonUtil.seated(params, look, scale, pose) : PersonUtil.standing(params, look, scale, pose);
|
|
111
|
+
return {
|
|
112
|
+
svg: shadow + drawn.svg,
|
|
113
|
+
hand: [drawn.hand[0] * scale.bx, drawn.hand[1] * scale.by],
|
|
114
|
+
box: { w: 40 * scale.bx, h: 81 * scale.by + 27 * scale.hs }
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
static bodyGroup(scale, content) {
|
|
118
|
+
const round = (value) => PersonArmUtil.round(value);
|
|
119
|
+
return `<g transform="scale(${round(scale.bx)} ${round(scale.by)})">${content}</g>`;
|
|
120
|
+
}
|
|
121
|
+
static headGroup(scale, content, tilt = 0) {
|
|
122
|
+
const round = (value) => PersonArmUtil.round(value);
|
|
123
|
+
const shift = round(-81 * scale.by + 81 * scale.hs);
|
|
124
|
+
return `<g transform="translate(0 ${shift}) scale(${round(scale.hs)}) rotate(${round(tilt)} 0 -82)">${content}</g>`;
|
|
125
|
+
}
|
|
126
|
+
static seated(params, look, scale, pose) {
|
|
127
|
+
const { theme, skin, sleeve, isShortSleeve } = look;
|
|
128
|
+
const facing = IdUtil.lookup(PersonUtil.FACING_TO_SIDE, params.facing) ?? 1;
|
|
129
|
+
const target = IdUtil.lookup(PersonUtil.POSE_NAME_TO_SIDE_HANDS, pose) ?? PersonUtil.TYPING_HANDS;
|
|
130
|
+
const shoulder = [facing * 2, -75];
|
|
131
|
+
const backArm = PersonArmUtil.ik(shoulder, [target[0] * facing - facing * 4, target[1] + 2], facing, "down");
|
|
132
|
+
const frontArm = PersonArmUtil.ik(shoulder, [target[0] * facing, target[1]], facing, "down");
|
|
133
|
+
const backSkin = ColorUtil.sh(skin, -0.15);
|
|
134
|
+
const backColors = { sleeve: ColorUtil.sh(sleeve, -0.18), skin: backSkin };
|
|
135
|
+
const armsBack = PersonArmUtil.armPath(shoulder, backArm, backColors, isShortSleeve) + PersonArmUtil.hand(backArm.hand, backSkin, false, backArm.elbow);
|
|
136
|
+
const armsFront = PersonArmUtil.armPath(shoulder, frontArm, { sleeve, skin }, isShortSleeve) + PersonArmUtil.hand(frontArm.hand, skin, false, frontArm.elbow);
|
|
137
|
+
const gaze = PersonUtil.gazeOf(params, pose, facing);
|
|
138
|
+
const head = PersonHeadUtil.head(params, theme, { side: facing, isBack: false, gaze });
|
|
139
|
+
const legs = PersonOutfitUtil.seatedLegs(look, facing);
|
|
140
|
+
const torso = PersonOutfitUtil.seatedTorso(look, facing);
|
|
141
|
+
const prop = PersonUtil.seatedProp(pose, frontArm.hand, facing, theme);
|
|
142
|
+
const svg = PersonUtil.bodyGroup(scale, armsBack + legs + torso) + PersonUtil.headGroup(scale, head, facing * gaze[1] * PersonUtil.SEATED_HEAD_TILT) + PersonUtil.bodyGroup(scale, armsFront + prop);
|
|
143
|
+
return { svg, hand: frontArm.hand };
|
|
144
|
+
}
|
|
145
|
+
static seatedProp(pose, hand, facing, theme) {
|
|
146
|
+
return IdUtil.lookup(PersonUtil.POSE_TO_SEATED_PROP, pose)?.(hand, facing, theme) ?? "";
|
|
147
|
+
}
|
|
148
|
+
static book(hand, facing, theme) {
|
|
149
|
+
const round = (value) => PersonArmUtil.round(value);
|
|
150
|
+
const [handX, handY] = hand;
|
|
151
|
+
return `<path d="M${round(handX - facing * 2)} ${round(handY - 9)} L${round(handX + facing * 8)} ${round(handY - 6)} L${round(handX + facing * 8)} ${round(handY + 4)} L${round(handX - facing * 2)} ${round(handY + 1)} Z" fill="${theme.accent}"/>`;
|
|
152
|
+
}
|
|
153
|
+
static cup(hand, facing, theme) {
|
|
154
|
+
const round = (value) => PersonArmUtil.round(value);
|
|
155
|
+
const [handX, handY] = hand;
|
|
156
|
+
return `<path d="M${round(handX + facing * 1)} ${round(handY - 7)} L${round(handX + facing * 9)} ${round(handY - 7)} L${round(handX + facing * 8)} ${round(handY + 3)} L${round(handX + facing * 2)} ${round(handY + 3)} Z" fill="${theme.paper}"/>`;
|
|
157
|
+
}
|
|
158
|
+
static standing(params, look, scale, pose) {
|
|
159
|
+
const { theme, skin, sleeve, isShortSleeve } = look;
|
|
160
|
+
const isBack = params.view === "back";
|
|
161
|
+
const targets = IdUtil.lookup(PersonUtil.POSE_NAME_TO_FRONT_POSE, pose) ?? PersonUtil.STANDING_POSE;
|
|
162
|
+
const side = IdUtil.lookup(PersonUtil.FACING_TO_SIDE, params.facing) ?? 0;
|
|
163
|
+
const legs = PersonOutfitUtil.standingLegs(look, pose === "walking");
|
|
164
|
+
const backpack = PersonOutfitUtil.backpack(look, params, isBack);
|
|
165
|
+
const torso = PersonOutfitUtil.standingTorso(look, params, isBack) + backpack.onTorso;
|
|
166
|
+
const hat = PersonOutfitUtil.hat(look, params, side);
|
|
167
|
+
const leftShoulder = [-12, -76];
|
|
168
|
+
const rightShoulder = [12, -76];
|
|
169
|
+
const left = PersonArmUtil.ik(leftShoulder, targets.left, -1, targets.bendLeft);
|
|
170
|
+
const right = PersonArmUtil.ik(rightShoulder, targets.right, 1, targets.bendRight);
|
|
171
|
+
const colors = { sleeve, skin };
|
|
172
|
+
const isLeftOpen = Boolean(targets.isLeftOpen);
|
|
173
|
+
const isRightOpen = Boolean(targets.isRightOpen);
|
|
174
|
+
const arms = PersonArmUtil.armPath(leftShoulder, left, colors, isShortSleeve) + PersonArmUtil.hand(left.hand, skin, isLeftOpen, left.elbow) + PersonArmUtil.armPath(rightShoulder, right, colors, isShortSleeve) + PersonArmUtil.hand(right.hand, skin, isRightOpen, right.elbow);
|
|
175
|
+
if (isBack) {
|
|
176
|
+
const head2 = PersonHeadUtil.head(params, theme, { side: 0, isBack: true, gaze: [0, 0] });
|
|
177
|
+
const backSvg = PersonUtil.bodyGroup(scale, legs + torso + arms) + PersonUtil.headGroup(scale, head2 + hat);
|
|
178
|
+
return { svg: backSvg, hand: right.hand };
|
|
179
|
+
}
|
|
180
|
+
const gaze = PersonUtil.gazeOf(params, pose, side || 1);
|
|
181
|
+
const tilt = side ? side * gaze[1] * PersonUtil.STANDING_HEAD_TILT : gaze[0] * PersonUtil.FRONT_HEAD_TILT;
|
|
182
|
+
const head = PersonHeadUtil.head(params, theme, { side, isBack: false, gaze });
|
|
183
|
+
const cane = PersonUtil.cane(params, targets, left.hand, theme);
|
|
184
|
+
const phone = PersonUtil.phone(pose, right.hand, theme);
|
|
185
|
+
const svg = PersonUtil.bodyGroup(scale, legs + backpack.behind + torso) + PersonUtil.headGroup(scale, head + hat, tilt) + PersonUtil.bodyGroup(scale, cane + arms + phone);
|
|
186
|
+
return { svg, hand: right.hand };
|
|
187
|
+
}
|
|
188
|
+
static cane(params, targets, hand, theme) {
|
|
189
|
+
if (!params.cane || Math.abs(targets.left[1] + 46) >= PersonUtil.CANE_REST_HEIGHT) {
|
|
190
|
+
return "";
|
|
191
|
+
}
|
|
192
|
+
const round = (value) => PersonArmUtil.round(value);
|
|
193
|
+
const wood = theme.trunk || "#6B4A33";
|
|
194
|
+
return `<path d="M${round(hand[0] - 1)} ${round(hand[1] + 2)} L${round(hand[0] - 4)} -1" stroke="${wood}" stroke-width="2.4" stroke-linecap="round"/><path d="M${round(hand[0] - 1)} ${round(hand[1] + 2)} Q${round(hand[0] + 1)} ${round(hand[1] - 4)} ${round(hand[0] + 5)} ${round(hand[1] - 1)}" stroke="${wood}" stroke-width="2.4" fill="none" stroke-linecap="round"/>`;
|
|
195
|
+
}
|
|
196
|
+
static phone(pose, hand, theme) {
|
|
197
|
+
if (pose !== "phone") {
|
|
198
|
+
return "";
|
|
199
|
+
}
|
|
200
|
+
const round = (value) => PersonArmUtil.round(value);
|
|
201
|
+
return `<rect x="${round(hand[0] - 1.5)}" y="${round(hand[1] - 8)}" width="4.6" height="8.5" rx="1.2" fill="${theme.ink}"/><rect x="${round(hand[0] - 0.8)}" y="${round(hand[1] - 7.2)}" width="3.2" height="6.4" rx="0.6" fill="${theme.glass || "#BFD7EA"}"/>`;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
export {
|
|
205
|
+
PersonUtil
|
|
206
|
+
};
|