#sasshat
简单易用的SASS库 The simple and easy sass library
这是个sass库,专为sass语言,如果你用的是LESS,请移步这个LESS高大上的库 lesshat.com
##DEMO 先看做的几个 ###DEMOs
###下面是几个gif是某app内hybrid形式嵌入去网页内动画截图
##代码使用例子 ####风骚的 sass 写法
div
+box-shadow(1px 1px 2px #000)
####或保守的 scss 写法
div{
@include box-shadow(1px 1px 2px #000);
}
####编译结果
// Results
div{
-webkit-box-shadow: 1px 1px 2px black;
-moz-box-shadow: 1px 1px 2px black;
-ms-box-shadow: 1px 1px 2px black;
box-shadow: 1px 1px 2px black;
}
##Get Started 1、新建一个以.sass或.scss结尾的文件如: demo.sass或demo.scss
2、在文件中引入如:@import '_sasshat.sass'
3、现在可以开始写你自己的sass了
##特点
- 书写css3更方便
- 特别适合手机web页面
- “多米诺”动画让animation动画更酷
##“多米诺”动画 多米諾骨牌,即碰倒第一枚骨牌,其余的骨牌就会产生连锁反应,依次倒下。 “多米诺”动画即引申自多米诺骨牌,即让一连串的HTML元素延时依次逐个完成相应的动画效果。
sasshat多米诺动画具体的CSS3动画其实是集成自**animate.css** 动画库。所以在编写多米諾动画时实现一些常见的效果已经不需要你去编写keyframes动画帧了,直接调用已经编写好的keyframes名称就可以.
为了减小css体积,请只导入要使用到的动画模块。 全部的动画模块已改成scss后缀,文件来源于animate.css项目
####编写“多米诺”动画的写法
1、先设置某个动画变量为true
2、导入_sasshat.sass文件和要用到的动画.scss文件
@import '_animate.scss','_sasshat.sass'
@import "animate/fading_entrances/fadeInUp.scss"
3、调用多米诺动画函数
+dominoAnimation(".lomo",fadeInUp, 1, 6)
#####Results
// 编译后就会生成以下内容,形成元素逐个按延时长短形成动画
@-webkit-keyframes fadeInUp {
0% {
opacity: 0;
-webkit-transform: translateY(20px); }
100% {
opacity: 1;
-webkit-transform: translateY(0); } }
@-moz-keyframes fadeInUp {
0% {
opacity: 0;
-moz-transform: translateY(20px); }
100% {
opacity: 1;
-moz-transform: translateY(0); } }
@-o-keyframes fadeInUp {
0% {
opacity: 0;
-o-transform: translateY(20px); }
100% {
opacity: 1;
-o-transform: translateY(0); } }
@keyframes fadeInUp {
0% {
opacity: 0;
transform: translateY(20px); }
100% {
opacity: 1;
transform: translateY(0); } }
.fadeInUp {
-webkit-animation-name: fadeInUp;
-moz-animation-name: fadeInUp;
animation-name: fadeInUp; }
.lomo:nth-child(1) {
-webkit-animation: fadeInUp 0.5s 0.1s ease;
-moz-animation: fadeInUp 0.5s 0.1s ease;
-ms-animation: fadeInUp 0.5s 0.1s ease;
animation: fadeInUp 0.5s 0.1s ease; }
.lomo:nth-child(2) {
-webkit-animation: fadeInUp 0.5s 0.2s ease;
-moz-animation: fadeInUp 0.5s 0.2s ease;
-ms-animation: fadeInUp 0.5s 0.2s ease;
animation: fadeInUp 0.5s 0.2s ease; }
.lomo:nth-child(3) {
-webkit-animation: fadeInUp 0.5s 0.3s ease;
-moz-animation: fadeInUp 0.5s 0.3s ease;
-ms-animation: fadeInUp 0.5s 0.3s ease;
animation: fadeInUp 0.5s 0.3s ease; }
.lomo:nth-child(4) {
-webkit-animation: fadeInUp 0.5s 0.4s ease;
-moz-animation: fadeInUp 0.5s 0.4s ease;
-ms-animation: fadeInUp 0.5s 0.4s ease;
animation: fadeInUp 0.5s 0.4s ease; }
.lomo:nth-child(5) {
-webkit-animation: fadeInUp 0.5s 0.5s ease;
-moz-animation: fadeInUp 0.5s 0.5s ease;
-ms-animation: fadeInUp 0.5s 0.5s ease;
animation: fadeInUp 0.5s 0.5s ease; }
.lomo:nth-child(6) {
-webkit-animation: fadeInUp 0.5s 0.6s ease;
-moz-animation: fadeInUp 0.5s 0.6s ease;
-ms-animation: fadeInUp 0.5s 0.6s ease;
animation: fadeInUp 0.5s 0.6s ease; }
.lomo {
-webkit-animation-fill-mode: both !important;
-moz-animation-fill-mode: both !important;
-ms-animation-fill-mode: both !important;
animation-fill-mode: both !important; }
####CSS3动画的优点(具体需要看浏览器实现) 1.不占用js主线程
2.可利用硬件加速
3.浏览器可对动画做优化(元素不可见时不动画, 减少对FPS的影响)
#####写法可以有以下几种,根据实际HTML结构选择使用
+dominoAnimation(li,scaleIn, 1, 4, .5s)
+dominoAnimation(li,scaleIn, 4, 1, .5s)
+dominoAnimation($loopElement:li,$frameName:fadeInLeft, $start:1, $end:4, $applyElement:'.type')
- align-content
flexbox
- align-items
flexbox
- align-self
flexbox
- animation
- animation-delay
- animation-direction
- animation-duration
- animation-fill-mode
- animation-iteration-count
- animation-name
- animation-play-state
- animation-timing-function
- appearance
- backface-visibility
- background-clip
- background-origin
- background-size
- blur
filter
- border-bottom-left-radius
- border-bottom-right-radius
- border-radius
- border-top-left-radius
- border-top-right-radius
- box-shadow
- box-sizing
- brightness
filter
- calc
- column-count
- column-gap
- column-rule
- column-width
- columns
- contrast
filter
- display
flexbox
- drop-shadow
filter
- filter
- flex
flexbox
- flex-wrap
flexbox
- font-face
- grayscale
filter
- hue-rotate
filter
- justify-content
flexbox
- keyframes
- opacity
- order
- perspective
- perspective-origin
- placeholder
- rotate
transform
- rotate3d
transform
- rotateX
transform
- rotateY
transform
- rotateZ
transform
- scale
transform
- scale3d
transform
- scaleX
transform
- scaleY
transform
- scaleZ
transform
- selection
- sepia
filter
- size
width, height
- skew
transform
- skewX
transform
- skewY
transform
- transform
- transform-origin
- transform-style
- transition
- transition-delay
- transition-duration
- transition-property
- transition-timing-function
- translate
transform
- translate3d
transform
- translateX
transform
- translateY
transform
- translateZ
transform
- user-select