diff --git a/test/scratch/scratch.html b/test/scratch/scratch.html index 02f93b23..1c573a9e 100644 --- a/test/scratch/scratch.html +++ b/test/scratch/scratch.html @@ -15,33 +15,7 @@ - @@ -107,5 +81,51 @@ Autorespond: Issue Request

--

+ + + + + +
+

Initial Content

+ +
+ + diff --git a/www/docs.md b/www/docs.md index 02efc810..35310eba 100644 --- a/www/docs.md +++ b/www/docs.md @@ -434,6 +434,8 @@ You can experiment with this new API using the following approaches: View Transitions can be configured using CSS, as outlined in [the Chrome documentation for the feature](https://developer.chrome.com/docs/web-platform/view-transitions/#simple-customization). +You can see a view transition example on the [Animation Examples](/examples/animations#view-transitions) page. + ### [Synchronization](#synchronization) Often you want to coordinate the requests between two elements. For example, you may want a request from one element diff --git a/www/examples/animations.md b/www/examples/animations.md index 650b2ea1..c0b48866 100644 --- a/www/examples/animations.md +++ b/www/examples/animations.md @@ -4,10 +4,13 @@ layout: demo_layout.njk ## Animations -Htmx is designed to allow you to use [CSS transitions](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Transitions/Using_CSS_transitions) +htmx is designed to allow you to use [CSS transitions](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Transitions/Using_CSS_transitions) to add smooth animations and transitions to your web page using only CSS and HTML. Below are a few examples of various animation techniques. +htmx also allows you to use the new [View Transitions API](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API) +for creating animations. + ### [Basic CSS Animations](#basic) #### Color Throb @@ -234,6 +237,100 @@ the transition time. This avoids flickering that can happen if the transition i
Toggle Demo
+### [Using the View Transition API](#view-transitions) + +htmx provides access to the new [View Transitions API](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API) +via the `transition` option of the [`hx-swap`](/attributes/hx-swap) attribute. Here is an example of a swap +that will use the transition: + +```html + + + +
+

Initial Content

+ +
+``` + +#### Demo + + + + + + +
+

Initial Content

+ +
+ #### Conclusion You can use the techniques above to create quite a few interesting and pleasing effects with plain old HTML while using htmx.