Jump to content
Search Community

Custom wiggle on a pseudo element

Jloafs test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

Hi everyone - thanks heaps in advance for any help. I'm trying to use the custom wiggle plugin for the first time on a pseudo element. I want the pseudo element to wiggle on rotation and loop infinitely. Really struggling with this - I don't think the custom wiggle is being used for the ease. Can anybody spot where I'm going wrong?

 

gsap.registerPlugin(CSSRulePlugin, CustomEase, CustomWiggle);
var rule = CSSRulePlugin.getRule(".intro--image-wrap:before"); //get the css rule for the :before psuedo element
CustomWiggle.create("iconWiggle", {wiggles:10, type:"random"}); // create the wiggle
const introIcons = gsap.timeline({})
introIcons.to(rule, {duration: 0.5, cssRule: {rotation: "2", ease: 'iconWiggle'},yoyo:true, repeat: -1, })

 

Link to comment
Share on other sites

  • Solution

It looks like you just put the ease in the wrong spot: 

// BAD
introIcons.to(rule, {duration: 0.5, cssRule: {rotation: "2", ease: 'iconWiggle'}, yoyo:true, repeat: -1})

// GOOD
introIcons.to(rule, {duration: 0.5, cssRule: {rotation: "2"}, ease: 'iconWiggle', yoyo:true, repeat: -1})

(don't nest it inside the cssRule:{} object). 

 

Does that help? 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...