MIT License

项目介绍

miniMAC/magic 是一个托管在 GitHub 上的开源项目,主要使用 SCSS 编写,采用 MIT License 许可证,目前获得 8.6k 个 Star、1.2k 次 Fork。

仓库全名
miniMAC/magic
开源许可证
MIT License
Star 数
8.6k
Fork 数
1.2k

README 摘要

:tophat: magic CSS3 Animations with special effects. (→ 3.1 kB gzip) Demo Checkout the demo for the animations here Table of Contents Installation Getting Started Usage with JavaScript Usage with jQuery HTML & CSS tips :tada: Gulp and SCSS (SASS) compiling :whitecheckmark: Browser Support Installation GitHub Package Registry - Package url NPM - Package url YARN - Package url Getting Started Include the file…

完整内容见 GitHub 原始 README 或本页 。

常见问题

magic 用什么语言开发?

主要使用 SCSS 编写,采用 MIT License 许可证,目前有 8.6k 个 Star。

magic 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 magic 的源码?

可以直接克隆仓库:git clone https://github.com/miniMAC/magic.git,默认分支为 master;安装与运行步骤见仓库 README。

magic 最近还在维护吗?

仓库最近一次更新为 2022年8月24日,当前没有未关闭的 Issue;Star 数为 8.6k,可作为社区活跃度的参考。

简要分析

热度分
11199
价值分
5531
活跃状态
活跃

语言占比

JavaScript
SCSS

Release

README

:tophat: 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

:tada: 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!

:white_check_mark: 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+ :x:

评论

暂无评论