Example Description
This example demonstrates how to layer elements on top of each other to create an illusion of a custom button with animation.
How We Built It
Page Elements
In our site we added 2 groups of page elements with the Group 1 layered on top of Group 2:
Group 1: A text element and a pink vector image.
Group 2: Identical text element and vector image shape, but this vector image is white.
Code
In the $w.onReady() function we declare the two groups of page elements. We then create the animation timeline:
Change the opacity of Group 1 to 0, hiding it from the page. Group 2 which is underneath, is shown in its place.
Rotate Group 2 by 360 degrees.
Change the opacity of Group1 back to 1, showing it again on the page.
Last, we added an onClick() event handler to Group 1, to function as a button and trigger the animation when Group 1 is clicked.
Related Examples
Did this help?
|
Thanks for your feedback!
![Ball Drop Animation](https://static.wixstatic.com/media/f0504e_2e0ba2adbf284a5cba91a430b3202d86~mv2.png/v1/fill/w_79,h_47,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_avif,quality_auto/Image%20placeholder.png)
Ball Drop Animation
Create a ball drop animation where balls fall through a maze and dot the letter I’s in your words.
![Intermediate.png](https://static.wixstatic.com/media/12d367_3e4cb40eaf29447896e3ccdc94a766e5~mv2.png/v1/fill/w_10,h_9,al_c,q_85,blur_3,enc_avif,quality_auto/Intermediate.png)
Advanced
![Solar System Animation](https://static.wixstatic.com/media/f0504e_66204fb88c254e6cbf9c1ac82596df1c~mv2.png/v1/fill/w_79,h_47,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_avif,quality_auto/Image%20placeholder.png)
Solar System Animation
Create a simplified solar system animation using the Wix Animations API.
![Intermediate.png](https://static.wixstatic.com/media/12d367_3e4cb40eaf29447896e3ccdc94a766e5~mv2.png/v1/fill/w_10,h_9,al_c,q_85,blur_3,enc_avif,quality_auto/Intermediate.png)
Advanced
![Vector Image Animation](https://static.wixstatic.com/media/f0504e_a707ab4c266b44f0b008a52befdd4aeb~mv2.png/v1/fill/w_79,h_43,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_avif,quality_auto/Image%20placeholder.png)
Vector Image Animation
Create an animation of a ball moving and then taking the place of the letter O’s in your words.
![Intermediate.png](https://static.wixstatic.com/media/12d367_3e4cb40eaf29447896e3ccdc94a766e5~mv2.png/v1/fill/w_10,h_9,al_c,q_85,blur_3,enc_avif,quality_auto/Intermediate.png)
Beginner
![Text Microinteractions](https://static.wixstatic.com/media/f0504e_fd8e796e943e44068a973d7d3ecdf631~mv2.jpg/v1/fill/w_79,h_43,al_c,q_80,usm_0.66_1.00_0.01,blur_2,enc_avif,quality_auto/Image%20placeholder.jpg)
Text Microinteractions
Create different microinteractions on 3 text elements using the Wix Animations API.
![Intermediate.png](https://static.wixstatic.com/media/12d367_3e4cb40eaf29447896e3ccdc94a766e5~mv2.png/v1/fill/w_10,h_9,al_c,q_85,blur_3,enc_avif,quality_auto/Intermediate.png)
Intermediate
![Hourglass Animation](https://static.wixstatic.com/media/f0504e_2e21f3f6a21b418392bff84c9ddc2296~mv2.png/v1/fill/w_72,h_52,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_avif,quality_auto/Image%20placeholder.png)
Hourglass Animation
Flip an hourglass automatically or on a button click using the Wix Animations API.
![Intermediate.png](https://static.wixstatic.com/media/12d367_3e4cb40eaf29447896e3ccdc94a766e5~mv2.png/v1/fill/w_10,h_9,al_c,q_85,blur_3,enc_avif,quality_auto/Intermediate.png)
Advanced