Giter VIP home page Giter VIP logo

quick-x-component's Introduction

#quick-x-component 这个仓库提交了一些平时开发过程中用到的实用组件或工具类

##TimerLabel local timerLabel = TimerLabel.new({ time = 60000, format = "TimerLabel演示:@M:@S" })

timerLabel:addEventListener(TimerLabel.ON_COUNT_DOWN,function(event)
    print("倒计时结束")
end)

timerLabel:align(display.LEFT_TOP,50,display.height - 50):addTo(self)

除了text外,display.newTTFLabel里的所有参数都有效
新增了time参数(单位毫秒),format参数(支持H M S),triggerTime参数(触发事件,不传时为0)
倒计时结束会触发TimerLabel.ON_COUNT_DOWN

##TypingLabel local typingLabel = TypingLabel.new({ text = "这是一个打字机效果,\n支持中英数组合,\n数字123456英文abcdefg" })

typingLabel:addEventListener(TypingLabel.ON_FINISH_TYPING,function(event)
    print("打字机结束")
end)

typingLabel:align(display.LEFT_TOP,50,display.height - 100):addTo(self)

参数和display.newTTFLabel一样
当点击改文字区块时,会一下显示完所有的文字
显示完文字后悔触发TypingLabel.ON_FINISH_TYPING

##RichLabel local label = RichLabel.new({ text = "

hello

hello
ok", size = 20, color = cc.c3b(255, 255, 255), maxWidth=90, lineSpace=0, charSpace=0, }) label:align(display.LEFT_TOP,50,display.height - 200) label:playAnimation() self:addChild(label) 这个参考了RichLabel
我只是把他揉在一个文件里并引入quick,只是方便使用罢了,没做什么贡献

##LazyLoader local lazy = LazyLoader.new() local lazyLabel = cc.ui.UILabel.new({ text = "aaaa", color = cc.c3b(255, 255, 255), }) lazyLabel:align(display.LEFT_TOP,50,display.height - 270) self:addChild(lazyLabel) local itemList = {} for i=1,10000 do itemList[i] = "No."..i end lazy:setItemList(itemList) lazy:onFunc(function(event) lazyLabel:setString(event.item) end) lazy:onCallback(function(event) lazyLabel:setString("Finish!!!") end) lazy:start() 这个非常适合list逐帧加载,可以实现loading条,或者背包,避免绘画线程锁死导致的降帧

##效果图 效果图

quick-x-component's People

Contributors

superyyl avatar

Stargazers

 avatar

Watchers

 avatar  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.