Code Monkey home page Code Monkey logo

valva's Introduction

Vâlvă

Vâlve are Romanian female spirits and shapeshifters.

Vâlvă is a small footprint JS library dedicated to transitions.
When a full-fledge framework is overkill, but relying solely on CSS is not an option.

Now v.1.1!

Demo

Quick and dirty demo available in docs/ or as a Github Page

Use

Browser

<script src="path/to/assets/Valva.min.js"></script>

Node

npm install @i-is-as-i-does/valva
import Valva from '@i-is-as-i-does/valva';

Important

Beware of adjacent elements with margin and/or padding. Vâlvă does not modify those.
If you're experiencing some unexpected jumps, try to wrap your animated element into a neutral, no-margin no-padding parent element.

Builds

Valva
dist/Valva.js | dist/Valva.min.js

ValvaAs
contains aliases and support for Valva v.1.0
dist/ValvaAs.js | dist/ValvaAs.min.js

Bonus

Vue 3 component in src/vue

Overview

* = required
type = ease, fade or ease (aka slide+fade)

// Fade-in, slide-down or ease-in, depending on {type} 
vShow(elm*, type, duration, callback, timing)

// Fade-out, slide-up or ease-out, depending on {type} 
vHide(elm*, type, duration, callback, timing)

// Fade-toggle, slide-toggle or ease-toggle, depending on {type} 
vToggle(elm*, type, duration, callback, timing)

// Toggle visibility, wait for {delay}, toggle back
vTempToggle(elm*, type, delay, duration, callback, timing)

// Toggle visibility, resolve {callback}, toggle back
vToggleResolve(elm*, callback, type, duration1, duration2, timing, reverse)

// Smooth append element to DOM
vPlace(parent*, child*, prepend, type, duration, callback,timing) 

// Smooth replace element in DOM
vReplace(oldElm*, newElm*, duration, callback, timing)

// Will `fade` if {elm} height = {prevHeight}, `ease` otherwise
vShowAdapt(elm*, prevHeight*, duration, callback, timing)

// Mesmerizing airport letter board effect
vSplitFlap(elm*, text*, speed) 

Defaults

type: 'ease' // aka slide+fade
duration: 300 // in ms
callback: null // function to execute once transition is done
timing: 'ease-in-out' // CSS timing function

delay: 1000 // vTempToggle
reverse: false // vToggleResolve
prepend: false // vPlace
speed: 20 // vSplitFlap

ease: true // insertDiversion & diversionToggle

Aliases

Available in ValvaAs
Mainly for Valva v1.0 support

Slide up/down

slideUp(elm*, duration, callback, timing)
slideDown(elm*, duration, callback, timing)
slideToggle(elm*, duration, callback, timing)
timedSlideToggle(elm*, duration, delay, callback, timing)

Fade in/out

fadeOut(elm*, callback, duration, timing)
fadeIn(elm*, callback, duration, timing)
fadeToggle(elm*, callback, duration, timing)
timedFadeToggle(elm*, delay, callback, duration, timing)

Ease in/out

easeOut(elm*, duration, callback, timing)
easeIn(elm*, duration, callback, timing)
easeToggle(elm*, duration, callback, timing)
timedEaseToggle(elm*, delay, duration, callback, timing)

Text split flap

splitFlap(elm*, text*, speed = 20)

Diversions

aka DOM modification helpers

diversionToggle(elm*, callback, ease, duration, reverse, timing)
insertDiversion(parent*, child*, prepend, ease, duration, callback, timing)
replaceDiversion(oldElm*, newElm*, callback, duration, timing)

Contributing

Sure! You can take a loot at CONTRIBUTING.

License

This project is under the MIT License; cf. LICENSE for details.

John Everett Millais, The Apparition, 1895
John Everett Millais, The Apparition, 1895

valva's People

Contributors

i-is-as-i-does avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.