GithubHelp home page GithubHelp logo

ife-css-sprites's Introduction

IFE Css Sprites

自动生成css 雪碧图工具。

安装&启动

  1. git clone [email protected]:AspenLuoQiang/ife-css-sprites.git
  2. npm run dev or npm run build

在线体验

IFE Css Sprites

算法

主要参考 http://www.aaai.org/Papers/ICAPS/2003/ICAPS03-029.pdf 算法

基本思路

  1. 排列矩形集合(S),按照高度从高到低进行排序
  2. 取最高的1个矩形(s1)的宽高作为容器(Box)的初始宽高(BoxW,BoxH)
  3. s1永远处于Box的左上角。BoxH 不变,BoxW 可以无线延伸
  4. 判断第2个矩形(s2)能不能放到 Box 按照从左到右,从高到底这个顺序的空隙里面
    • 如果可以:放入 并 判断 BoxW 是否需要延伸
    • 如果不可以:放到s1的右边,BoxW 延伸
  5. 继续第3步,判断s3, s4, s5......

扩展思路

  1. 根据Box的初始高度,可以得到最终最小面积(Best)的第一个样本(Sample)
  2. 通过阶梯增加Box的高度(boxHeightStep),得到多个样本
  3. 比较每个样本的 面积利用率(U),取最高的那个

ife-css-sprites's People

Contributors

guyue88 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ife-css-sprites's Issues

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.