Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating custom animations #4

Open
pieterdd opened this issue Oct 27, 2018 · 4 comments
Open

Creating custom animations #4

pieterdd opened this issue Oct 27, 2018 · 4 comments

Comments

@pieterdd
Copy link

Is there a recommended way to define custom animations? I tried creating one myself and including this in the page's stylesheet:

@keyframes ken-burns-test {
    to {
        transform: scale3d(1.05, 1.05, 1.05) translate3d(1%, -2%, 0);
    }
}

Then I set animation-names="ken-burns-test". Oddly enough the animation doesn't get used, possibly because the Ken Burns carousel is using a shadow DOM that - I assume - doesn't inherit any of its parent DOM's CSS rules.

@NeoLegends
Copy link
Member

NeoLegends commented Oct 29, 2018

Hey,

you're right, the element doesn't inherit any rules and as such it's not possible to define custom animations right now.

I'm thinking about adding a property to the element, which you can assign CSS code to, that will be reflected into the elements styles, but this is rather hacky and I'd like to avoid that. I'd much rather have CSS Shadow Parts support here. You could also accomplish this with JavaScript yourself. Just get a reference to the DOM element, and work with it's .shadowRoot.

That said, which animation are you missing? We could just add it to the "official" set of animations, if it is general enough. :)

@pieterdd
Copy link
Author

While I like the default animations, I wanted to tone them down to make the effect more subtle. I was thinking more along the lines of something like transform: scale3d(1.05, 1.05, 1.05) translate3d(1%, -2%, 0); for example. Ideally, there would be some kind of intensity attribute I could use to control the zoom amount with.

The JavaScript method sounds like the best option for me right now, thanks for that tip!

@NeoLegends
Copy link
Member

You might be able to achieve what you want by configuring the transition duration, though. :) Another idea: we could add a separate toggle that sets animation speed independent from the transition duration.

@pieterdd
Copy link
Author

A transition duration of 7 seconds per slide is already what I want, I just want the animation to be more subtle. So yes, an animation speed controller sounds good.

Or how about adding attributes to control the minimum and maximum zoom level? That would mean you'd have to write your animation CSS on the fly, but it would provide people with a way to have more control.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants