top of page
Custom Button Animation

Custom Button Animation

Create a custom button that rotates clockwise and changes color on click using the Wix Animations API.

Intermediate.png

Beginner

5K

Published:

August 11, 2021

Girl Enjoying her Drink

by

Anchor 1
Hire a Developer

Example Description

This example demonstrates how to layer elements on top of each other to create an illusion of a custom button with animation.

Example Code

Tab 1

.

Tab 2

.

Tab 3

.

This code solution can be complicated.

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:

  1. Change the opacity of Group 1 to 0, hiding it from the page. Group 2 which is underneath, is shown in its place.

  2. Rotate Group 2 by 360 degrees.

  3. 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.

APIs We Used

Non-code example.

Related Articles

Article Link

Hire a Developer

Velo solutions are powerful tools, but building them on your own can be challenging. Let an experienced Velo development shop build it for you, so you can keep working on your site or business.

Related Examples

Did this help?

Yes

|

No

Thanks for your feedback!

Ball Drop Animation

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

Advanced

Solar System Animation

Solar System Animation

Create a simplified solar system animation using the Wix Animations API.

Intermediate.png

Advanced

Vector Image Animation

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

Beginner

Text Microinteractions

Text Microinteractions

Create different microinteractions on 3 text elements using the Wix Animations API.

Intermediate.png

Intermediate

Hourglass Animation

Hourglass Animation

Flip an hourglass automatically or on a button click using the Wix Animations API.

Intermediate.png

Advanced

Anchor 2

This website was designed with Velo by Wix

bottom of page