Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
angular-three
Advanced tools
Leverage your Angular to build 3D applications with THREE.js
npx ng add angular-three
npm i angular-three
npx nx g angular-three:init
npm i angular-three three
npm i -D @types/three
tsconfig.json
(or tsconfig.base.json
) to include skipTypeCheck: false
Typically, we'd want to keep
three
and@types/three
on the same minor version. Eg:0.147
,0.148
etc..
ng add
or nx generate
command, this is setup for you.angular-three
manually, you can do the following steps to enable typings
.vscode/settings.json
, or create one if you do not have ithtml.customData
property with the value of ["./node_modules/angular-three/metadata.json"]
. If html.customData
exists, simply add "./node_modules/angular-three/metadata.json"
to the arrayweb-types
property to package.json
with the value of "./node_modules/angular-three/web-types.json"
Setup will vary depending on your current NeoVim configuration. However, I'd expect the required steps to be the same
neovim/nvim-lspconfig
needs to be configured for html
LSPinit_options.dataPaths
needs to include the path to node_modules/angular-three/metadata.json
html/customDataContent
handler (handlers = {["html/customDataContent"] = function() ... end}
for Lua syntax)
and return the content of the init_options.dataPaths
Here's an example setup for LazyVim
return {
{
"neovim/nvim-lspconfig",
---@class PluginLspOpts
opts = {
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
setup = {
html = function(_, opts)
opts.init_options = {
dataPaths = {
vim.fn.getcwd() .. "/node_modules/angular-three/metadata.json",
},
configurationSection = { "html", "css", "javascript" },
embeddedLanguages = {
css = true,
javascript = true,
},
provideFormatter = true,
}
opts.handlers = {
["html/customDataContent"] = function(err, result, ctx, config)
local function exists(name)
if type(name) ~= "string" then
return false
end
return os.execute("test -e " .. name)
end
if not vim.tbl_isempty(result) and #result == 1 then
if not exists(result[1]) then
return ""
end
local content = vim.fn.join(vim.fn.readfile(result[1]), "\n")
return content
end
return ""
end,
}
return false
end,
},
},
},
}
Read more about Angular Three usages in Documentations
Scene
component as a Standalone Componentimport { extend } from 'angular-three';
import { Mesh, BoxGeometry, MeshBasicMaterial } from 'three';
extend({ Mesh, BoxGeometry, MeshBasicMaterial });
@Component({
standalone: true,
template: `
<ngt-mesh>
<ngt-box-geometry />
<ngt-mesh-basic-material color="darkred" />
</ngt-mesh>
`,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class Scene {}
extend
will add the THREE entities to angular-three
catalogue which allows the renderer to recognize the custom tags: ngt-mesh
, ngt-box-geometry
etc..ngt-
+ THREE classes in kebab-case. Mesh
-> ngt-mesh
schemas: [CUSTOM_ELEMENTS_SCHEMA]
allows us to use custom tags on the template. This is Angular's limitation at the moment<ngt-canvas>
component, use Scene
component above to pass into [sceneGraph]
input on <ngt-canvas>
<ngt-canvas [sceneGraph]="Scene" />
ngt-canvas
creates the basic building blocks of THREE.js: a default WebGLRenderer
, a default Scene
, and a default PerspectiveCamera
Contributions are welcomed
FAQs
Angular Renderer for THREE.js
The npm package angular-three receives a total of 649 weekly downloads. As such, angular-three popularity was classified as not popular.
We found that angular-three demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.