Capítulo 141 de 142
Curated recipes from Motion's official examples gallery for misc & advanced. Each entry is implemented in one or more of vanilla JS, React, and Vue; consult the framework-specific example on motion.dev for the full runnable version.
<div id="three-container"></div>
<script type="module">
import * as THREE from "https://cdn.jsdelivr.net/npm/three@v0.149.0/build/three.module.js"
const main = document.getElementById("three-container")
const scene = new THREE.Scene({ alpha: true })
const camera = new THREE.PerspectiveCamera(
25,
main.offsetWidth / main.offsetHeight,
0.1,
1000
)
const renderer = new THREE.WebGLRenderer({ antialias: true })
renderer.setSize(main.offsetWidth, main.offsetHeight)
main.appendChild(renderer.domElement)
const geometry = new THREE.BoxGeometry()
// ...
<div class="container">
<div class="swatch-container">
<div class="swatch waapi"></div>
<div class="label">Browser</div>
</div>
<div class="swatch-container">
<div class="swatch motion"></div>
<div class="label">Motion</div>
</div>
</div>
<style>
/** Copy styles from example source code */
</style>