Laxxx.js ---a light weight Plugin to create animation when scrolling


It's a imple & light weight (<3kb gzipped) vanilla javascript plugin to create smooth & beautiful animations when you scrolllll! 



How I create this animated page with the Plugin?

Step1: 


Link the lax.js file to your website ,which is the eaiest way to apply. Or with the npm install to apply especially with React and so on.


Step2:

JS 
Add the script in the body  for init the plugin.

Step3:

HTML
Select the tags which you want to add animations and attach the classname and attributes.




Set the classname to lax to point the animation tags.

And data-lax-preset is the default animation setting which is easier and quick apply. Or you can customize the animation attributes with custom data setting.

Supported preset values from official:

Default Strength
lingern/a
lazy100
eager100
lazy100
slalom50
crazyn/a
spin360
spinRev360
spinIn360
spinOut360
blurInOut40
blurIn40
blurOut40
fadeInOutn/a
fadeInn/a
fadeOutn/a
driftLeft100
driftRight100
leftToRight1
rightToLeft1
zoomInOut0.2
zoomIn0.2
zoomOut0.2
swing30
speedy30
TransformKey
opacitydata-lax-opacity
translatedata-lax-translate
translateXdata-lax-translate-x
translateYdata-lax-translate-y
scaledata-lax-scale
scaleXdata-lax-scale-x
scaleYdata-lax-scale-y
skewdata-lax-skew
skewXdata-lax-skew-x
skewYdata-lax-skew-y
rotatedata-lax-rotate
rotateXdata-lax-rotate-x
rotateYdata-lax-rotate-y
Transform
Default Strength
lingern/a
lazy100
eager100
lazy100
slalom50
crazyn/a
spin360
spinRev360
spinIn360
spinOut360
blurInOut40
blurIn40
blurOut40
fadeInOutn/a
fadeInn/a
fadeOutn/a
driftLeft100
driftRight100
leftToRight1
rightToLeft1
zoomInOut0.2
zoomIn0.2
zoomOut0.2
swing30
speedy30
If you just wanna change the specific value of preset. Just add the value you want after the preset name after the "-".Such as..

Supported attributes keys from official:

Transforms
Key
opacitydata-lax-opacity
translatedata-lax-translate
translateXdata-lax-translate-x
translateYdata-lax-translate-y
scaledata-lax-scale
scaleXdata-lax-scale-x
scaleYdata-lax-scale-y
skewdata-lax-skew
skewXdata-lax-skew-x
skewYdata-lax-skew-y
rotatedata-lax-rotate
rotateXdata-lax-rotate-x
rotateYdata-lax-rotate-y
FilterKey
brightnessdata-lax-brightness
contrastdata-lax-contrast
hue-rotatedata-lax-hue-rotate
blurdata-lax-blur
invertdata-lax-invert
saturatedata-lax-saturate
grayscaledata-lax-grayscale
Filter
Key
opacitydata-lax-opacity
translatedata-lax-translate
translateXdata-lax-translate-x
translateYdata-lax-translate-y
scaledata-lax-scale
scaleXdata-lax-scale-x
scaleYdata-lax-scale-y
skewdata-lax-skew
skewXdata-lax-skew-x
skewYdata-lax-skew-y
rotatedata-lax-rotate
rotateXdata-lax-rotate-x
rotateYdata-lax-rotate-y
Filters (note - these may be unperformant on low powered machines)
Key
brightnessdata-lax-brightness
contrastdata-lax-contrast
hue-rotatedata-lax-hue-rotate
blurdata-lax-blur
invertdata-lax-invert
saturatedata-lax-saturate
grayscaledata-lax-grayscale
FilterKey
background positiondata-lax-bg-pos
background position-xdata-lax-bg-pos-x
background position-ydata-lax-bg-pos-y
Filter
Key
brightnessdata-lax-brightness
contrastdata-lax-contrast
hue-rotatedata-lax-hue-rotate
blurdata-lax-blur
invertdata-lax-invert
saturatedata-lax-saturate
grayscaledata-lax-grayscale
Other


Key
background positiondata-lax-bg-pos
background position-xdata-lax-bg-pos-x
background position-ydata-lax-bg-pos-y
x
Key
background positiondata-lax-bg-pos
background position-xdata-lax-bg-pos-x
background position-ydata-lax-bg-pos-y
For more attributes and values setting, go to Github

My demo code Github




Popular posts from this blog

Fancyapps — easily build overlay windows with carousel

Thoughts about Progressive Web App

Meet Mantine: A TS-Based Open-Source React Components Library