-
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(cookbook): "Advanced Animations" cookbook recipe (#586)
* chore: setup "Advanced Animations" cookbook pages * feat: StackBlitz embed update * feat: finish german + english content * chore: update screenshot * chore: lint fix * feat: update stackblitz + screenshot --------- Co-authored-by: Alvaro Saburido <[email protected]>
- Loading branch information
1 parent
7b88bf9
commit 0bd38ee
Showing
7 changed files
with
156 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
title: Advanced Animations | ||
description: How to use GSAP to animate your scene | ||
author: dennissmuda | ||
thumbnail: /recipes/advanced-animations.png | ||
difficulty: 0 | ||
--- | ||
|
||
# Advanced Animations | ||
|
||
In this guide, we are going to use GSAP to animate our scene instead of the `useRenderLoop` composable. | ||
|
||
<StackBlitzEmbed project-id="tresjs-advanced-animations" /> | ||
|
||
## Use GSAP to trigger animations on 3D Objects | ||
|
||
We don't have to rely on `useRenderLoop` or TresJS to handle our animations. We could also leverage GSAP's `to` function for example: | ||
|
||
```ts | ||
import gsap from 'gsap' | ||
|
||
const objectRef = shallowRef(null) | ||
|
||
watchEffect(() => { | ||
if (objectRef.value) { | ||
gsap.to(objectRef.value.position, { | ||
y: 2, | ||
}) | ||
} | ||
}) | ||
``` | ||
|
||
GSAP is a very popular animation library and you can find a lot of help and resources online, including [these demos on codepen](https://codepen.io/GreenSock). | ||
|
||
Of course there are lots of alternatives out there, and you should feel free to reach for _your_ favorite animation library! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
title: Fortgeschrittene Animationen | ||
description: Wie man mit GSAP eine Szene animiert | ||
author: dennissmuda | ||
thumbnail: /recipes/animations.png | ||
difficulty: 0 | ||
--- | ||
|
||
# Fortgeschrittene Animationen | ||
|
||
In diesem Rezept werden wir GSAP verwenden um unsere Szene zu animieren, statt des `useRenderLoop`-Composables. | ||
|
||
<StackBlitzEmbed project-id="tresjs-advanced-animations" /> | ||
|
||
## 3D Objekte mit GSAP animieren | ||
|
||
Wir müssen nicht unbedingt `useRenderLoop` oder gar TresJS für unsere Animationen benutzen. Zum Beispiel könnten wir auch GSAP's `to`-Method verwenden: | ||
|
||
```ts | ||
import gsap from 'gsap' | ||
|
||
const objectRef = shallowRef(null) | ||
|
||
watchEffect(() => { | ||
if (objectRef.value) { | ||
gsap.to(objectRef.value.position, { | ||
y: 2, | ||
}) | ||
} | ||
}) | ||
``` | ||
|
||
GSAP ist schon seit vielen Jahren eine sehr beliebte Animations-Library im Web. Es gibt also unzählige Resourcen online wie zum Beispiel [diese Demos auf Codepen](https://codepen.io/GreenSock). | ||
|
||
Du kannst natürlich auch _deine_ Lieblingsbibliothek nutzen, an Animations-Bibliotheken mangelt es im Web nicht! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
title: Animaciones avanzadas | ||
description: Cómo utilizar GSAP para animar tu escena | ||
author: dennissmuda | ||
thumbnail: /recipes/animations.png | ||
difficulty: 1 | ||
--- | ||
|
||
# Animaciones avanzadas | ||
|
||
En esta guía, vamos a utilizar GSAP para animar nuestra escena en lugar del composable `useRenderLoop`. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.