GithubHelp home page GithubHelp logo

hhy5277 / magic-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from minimac/magic

0.0 1.0 0.0 335 KB

CSS3 Animations with special effects

Home Page: https://www.minimamente.com/project/magic/

License: MIT License

CSS 98.32% JavaScript 1.68%

magic-1's Introduction

๐ŸŽฉ magic

CSS3 Animations with special effects. (โ†’ 3.1 kB gzip)

Demo

Checkout the demo for the animations here

Table of Contents

Installation

GitHub Package Registry - Package url

npm install @minimac/magic.css

NPM - Package url

npm i magic.css

YARN - Package url

yarn add magic.css

Getting Started

Include the file magic.css or include the minified version magic.min.css

<link rel="stylesheet" href="yourpath/magic.css">

or

<link rel="stylesheet" href="yourpath/magic.min.css">

Usage with JavaScript

This is a sample code for on hover effect with JavaScript. First, Include the class magictime and then a desired animation class.

const selector = document.querySelector('.yourdiv')
selector.classList.add('magictime', 'puffIn')

If you want to load the animation after certain time, you can use this example:

//set timer to 5 seconds, after that, load the magic animation
function myFunction() {
    const selector = document.querySelector('.yourdiv')
    selector.classList.add('magictime', 'puffIn')
}
setTimeout(myFunction, 5000);

If you want to load the animation after certain time but with an infinite loop, you can use this example:

//set timer to 3 seconds, after that, load the magic animation and repeat forever
function myFunction() {
    const selector = document.querySelector('.yourdiv')
    selector.classList.add('magictime', 'puffIn')
}
setInterval(myFunction, 3000);

Usage with jQuery

This is a sample code for on hover effect with jQuery. First, Include the class magictime and then the desired animation class.

$('.yourdiv').hover(function () {
    $(this).addClass('magictime puffIn');
});

If you want to load the animation after certain time, you can use this example:

//set timer to 5 seconds, after that, load the magic animation
setTimeout(function(){
    $('.yourdiv').addClass('magictime puffIn');
}, 5000);

If you want to load the animation after certain time but with infinite loop, you can use this example:

//set timer to 3 seconds, after that, load the magic animation and repeat forever
setInterval(function(){
    $('.yourdiv').toggleClass('magictime puffIn');
}, 3000 );

HTML & CSS tips

You can change the time of the animation by setting the class magictime for example:

.magictime {
    -webkit-animation-duration: 3s;
    animation-duration: 3s;
}

Default CSS timing is:

.magictime {
    -webkit-animation-duration: 1s;
    animation-duration: 1s;
}

If you want to assign the timing to a specific animation, you can use the following code (use 2 class):

.magictime.magic {
    -webkit-animation-duration: 10s;
    animation-duration: 10s;
}

Animation Classes

MAGIC EFFECTS BLING STATIC EFFECTS STATIC EFFECTS OUT PERSPECTIVE ROTATE
magic puffIn openDownLeft openDownLeftOut perspectiveDown rotateDown
twisterInDown puffOut openDownRight openDownRightOut perspectiveUp rotateUp
twisterInUp vanishIn openUpLeft openUpLeftOut perspectiveLeft rotateLeft
swap vanishOut openUpRight openUpRightOut perspectiveRight rotateRight
openDownLeftReturn perspectiveDownReturn
openDownRightReturn perspectiveUpReturn
openUpLeftReturn perspectiveLeftReturn
openUpRightReturn perspectiveRightReturn
SLIDE MATH TIN BOMB BOING ON THE SPACE
slideDown swashOut tinRightOut bombRightOut boingInUp spaceOutUp
slideUp swashIn tinLeftOut bombLeftOut boingOutDown spaceOutRight
slideLeft foolishIn tinUpOut spaceOutDown
slideRight holeOut tinDownOut spaceOutLeft
slideDownReturn tinRightIn spaceInUp
slideUpReturn tinLeftIn spaceInRight
slideLeftReturn tinUpIn spaceInDown
slideRightReturn tinDownIn spaceInLeft

๐ŸŽ‰ Gulp and SCSS (SASS) compiling

If you want to customize the CSS files, now you will have the chance. For example, if you want to include only certain animations, you will have to go to this file:

assets/scss/magic.scss

Comment or uncomment your desired file and run from terminal the following commands:

npm install

and last command:

gulp

Automatically this generate the new files!

โœ… Browser Support

Browser Chrome Firefox Safari iOS Safari Opera Android Android Chrome IE Opera Mini
Version 31+ 31+ 7+ 7.1+ 27+ 4.1+ 42+ 10+ โŒ

magic-1's People

Contributors

argyleink avatar dennisxzx avatar hainuo avatar jrutheiser avatar kkirsche avatar minimac avatar skeiter9 avatar sylvenas avatar vishnu-dev 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.