Custom Button That Rotates Clockwise And Changes Color On Click - Velo by Wix
- eggwebtut
- Sep 19, 2021
- 1 min read
Page Code:
import { timeline } from 'wix-animations' // ID: 7106D147D53400B9BB5AFFADBF985D6D $w.onReady(function () { // Declare the two groups of page elements const pink = $w('#buttonGroup1') const white = $w('#buttonGroup2') // Create the timeline // First hide the pink button, then rotate the white one const tl = timeline() .add(pink, { duration: 500, opacity: 0 }) .add(white, { duration: 750, rotate: 360 }) .add(pink, { duration: 300, opacity: 1 }) // On click replay the timeline from the beginning pink.onClick(() => tl.replay()) });
Comments