{"id":13402648,"url":"https://github.com/tengbao/vanta","last_synced_at":"2025-04-25T14:45:10.413Z","repository":{"id":37548442,"uuid":"97560949","full_name":"tengbao/vanta","owner":"tengbao","description":"Animated 3D backgrounds for your website","archived":false,"fork":false,"pushed_at":"2024-03-03T13:48:00.000Z","size":5212,"stargazers_count":5996,"open_issues_count":73,"forks_count":1052,"subscribers_count":41,"default_branch":"master","last_synced_at":"2025-04-24T08:33:17.750Z","etag":null,"topics":["3d","animation","animations","background","three-js","threejs"],"latest_commit_sha":null,"homepage":"http://vantajs.com/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tengbao.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-18T06:29:17.000Z","updated_at":"2025-04-24T01:23:30.000Z","dependencies_parsed_at":"2024-05-31T08:01:29.012Z","dependency_job_id":"55e6385a-813a-4aae-ba4e-d010b3ed1e0f","html_url":"https://github.com/tengbao/vanta","commit_stats":{"total_commits":191,"total_committers":11,"mean_commits":"17.363636363636363","dds":0.4345549738219895,"last_synced_commit":"f8b351906688b56f0fc744e53bde81fc3c56f150"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tengbao%2Fvanta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tengbao%2Fvanta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tengbao%2Fvanta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tengbao%2Fvanta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tengbao","download_url":"https://codeload.github.com/tengbao/vanta/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250836455,"owners_count":21495372,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["3d","animation","animations","background","three-js","threejs"],"created_at":"2024-07-30T19:01:18.870Z","updated_at":"2025-04-25T14:45:10.391Z","avatar_url":"https://github.com/tengbao.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Development"],"sub_categories":["Programming"],"readme":"# Vanta JS\n\n## [View demo gallery \u0026 customize effects at www.vantajs.com \u0026rarr;](https://www.vantajs.com)\n\n[![alt text](https://www.vantajs.com/gallery/vanta-preview.gif \"Vanta JS\")](https://www.vantajs.com)\n\n\n\n## What is Vanta? / FAQs\n\n- **Add 3D animated digital art to any webpage with just a few lines of code.**\n- How it works: Vanta inserts an animated effect as a background into any HTML element.\n- Works with vanilla JS, React, Angular, Vue, etc.\n- Effects are rendered by [three.js](https://github.com/mrdoob/three.js/) (using WebGL) or [p5.js](https://github.com/processing/p5.js).\n- Effects can interact with mouse/touch inputs.\n- Effect parameters (e.g. color) can be easily modified to match your brand.\n- Total additional file size is ~120kb minified and gzipped (mostly three.js), which is smaller than comparable background images/videos.\n- Vanta includes many predefined effects to try out. *More effects will be added soon!*\n\n## [View demo gallery \u0026 customize effects at www.vantajs.com \u0026rarr;](https://www.vantajs.com)\n\n## Basic usage with script tags:\n\n```html\n\u003cscript src=\"https://cdnjs.cloudflare.com/ajax/libs/three.js/r134/three.min.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/vanta/dist/vanta.waves.min.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  VANTA.WAVES('#my-background')\n\u003c/script\u003e\n```\n\n[View fiddle \u0026rarr;](https://jsfiddle.net/usdzfbLt/1/)\n\n## More options:\n\n```js\nVANTA.WAVES({\n  el: '#my-background', // element selector string or DOM object reference\n  color: 0x000000,\n  waveHeight: 20,\n  shininess: 50,\n  waveSpeed: 1.5,\n  zoom: 0.75\n})\n```\n\n- **el:** The container element.\n  - The Vanta canvas will be appended as a child of this element, and will assume the width and height of this element. (If you want a fullscreen canvas, make sure this container element is fullscreen.)\n  - This container *can* have other children. The other children will appear as foreground content, in front of the Vanta canvas.\n\n- **mouseControls:** (defaults to *true*) Set to false to disable mouse controls. Only applies to certain effects.\n\n- **touchControls:** (defaults to *true*) Set to false to disable touch controls. Only applies to certain effects.\n\n- **gyroControls:** (defaults to *false*) Set to true to allow gyroscope to imitate mouse. Only applies to certain effects.\n\n- **NOTE:** Each effect has its own specific parameters. Explore them all at www.vantajs.com!\n\n## Updating options after init:\n\n```js\nconst effect = VANTA.WAVES({\n  el: '#my-background',\n  color: 0x000000\n})\n\n// Later, when you want to update an animation in progress with new options\neffect.setOptions({\n  color: 0xff88cc\n})\n\n// Later, if the container changes size and you want to force Vanta to redraw at the new canvas size\neffect.resize()\n```\n\n## Cleanup:\n\n```js\nconst effect = VANTA.WAVES('#my-background')\neffect.destroy() // e.g. call this in React's componentWillUnmount\n```\n\n\n## Usage with React Hooks:\n\n`npm i vanta`, then import a specific effect as follows. Make sure `three.js` or `p5.js` has already been included via \u0026lt;script\u003e tag.\n\n```js\nimport React, { useState, useEffect, useRef } from 'react'\nimport BIRDS from 'vanta/dist/vanta.birds.min'\n// Make sure window.THREE is defined, e.g. by including three.min.js in the document head using a \u003cscript\u003e tag\n\nconst MyComponent = (props) =\u003e {\n  const [vantaEffect, setVantaEffect] = useState(null)\n  const myRef = useRef(null)\n  useEffect(() =\u003e {\n    if (!vantaEffect) {\n      setVantaEffect(BIRDS({\n        el: myRef.current\n      }))\n    }\n    return () =\u003e {\n      if (vantaEffect) vantaEffect.destroy()\n    }\n  }, [vantaEffect])\n  return \u003cdiv ref={myRef}\u003e\n    Foreground content goes here\n  \u003c/div\u003e\n}\n```\n[View fiddle \u0026rarr;](https://jsfiddle.net/1mcr7x50/2/)\n\n\n\n## Usage with React Classes:\n\n`npm i vanta`, then import a specific effect as follows. Make sure `three.js` or `p5.js` has already been included via \u0026lt;script\u003e tag.\n\n```js\nimport React from 'react'\nimport BIRDS from 'vanta/dist/vanta.birds.min'\n// Make sure window.THREE is defined, e.g. by including three.min.js in the document head using a \u003cscript\u003e tag\n\nclass MyComponent extends React.Component {\n  constructor() {\n    super()\n    this.vantaRef = React.createRef()\n  }\n  componentDidMount() {\n    this.vantaEffect = BIRDS({\n      el: this.vantaRef.current\n    })\n  }\n  componentWillUnmount() {\n    if (this.vantaEffect) this.vantaEffect.destroy()\n  }\n  render() {\n    return \u003cdiv ref={this.vantaRef}\u003e\n      Foreground content goes here\n    \u003c/div\u003e\n  }\n}\n```\n[View fiddle \u0026rarr;](https://jsfiddle.net/4fzxhv1w/2/)\n\n\n\n## Usage with Vue 2 (SFC):\n\n```vue\n\u003ctemplate\u003e\n  \u003cdiv ref='vantaRef'\u003e\n    Foreground content here\n  \u003c/div\u003e\n\u003c/template\u003e\n\n\u003cscript\u003e\nimport BIRDS from 'vanta/dist/vanta.birds.min'\n// Make sure window.THREE is defined, e.g. by including three.min.js in the document head using a \u003cscript\u003e tag\n\nexport default {\n  mounted() {\n    this.vantaEffect = BIRDS({\n      el: this.$refs.vantaRef\n    })\n  },\n  beforeDestroy() {\n    if (this.vantaEffect) {\n      this.vantaEffect.destroy()\n    }\n  }\n}\n\u003c/script\u003e\n```\n\n## Using THREE or p5 from npm\n\nFor effects that use three.js, you can import `three` from npm, and pass it into the effect function.\n\n```js\nimport React from 'react'\nimport * as THREE from 'three'\nimport BIRDS from 'vanta/dist/vanta.birds.min'\n\n...\n  componentDidMount() {\n    this.vantaEffect = BIRDS({\n      el: this.vantaRef.current,\n      THREE: THREE // use a custom THREE when initializing\n    })\n  }\n...\n```\n\nFor effects that use p5.js, you can import `p5` from npm, and pass it into the effect function.\n\n```js\nimport React from 'react'\nimport p5 from 'p5'\nimport TRUNK from 'vanta/dist/vanta.trunk.min'\n\n...\n  componentDidMount() {\n    this.vantaEffect = TRUNK({\n      el: this.vantaRef.current,\n      p5: p5 // use a custom p5 when initializing\n    })\n  }\n...\n```\n\n\n## Local dev:\n\nClone the repo, switch to the `gallery` branch, run `npm install` and `npm run dev`, and go to localhost:8080.\n\n## Credits\n\n- General inspiration from [shadertoy.com](https://www.shadertoy.com), [#generative](https://www.twitter.com/hashtag/generative), [/r/generative](https://www.reddit.com/r/generative/), [/r/creativecoding](https://www.reddit.com/r/creativecoding/), etc\n\n- Birds effect from https://threejs.org/examples/?q=birds#webgl_gpgpu_birds by @zz85\n- Fog effect from https://thebookofshaders.com/13/ by @patriciogonzalezvivo\n- Clouds effect from https://www.shadertoy.com/view/XslGRr by Inigo Quilez\n- Clouds2 effect from https://www.shadertoy.com/view/lsBfDz by Rune Stubbe\n- Trunk, Topology effects from http://generated.space/ by Kjetil Midtgarden Golid @kgolid\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftengbao%2Fvanta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftengbao%2Fvanta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftengbao%2Fvanta/lists"}