Cocos Creator 组件式开发,刚开始学习,使用js语言,写个轮盘抽奖测试。
github链接
查看效果
cc.Class({
extends: cc.Component,
properties: {
spinBtn: {
default: null, // The default value will be used only when the component attachin // to a node for the first time
type:cc.Button, // optional, default is typeof default
visible: true, // optional, default is true
displayName: 'SpinBtn', // optional
},
wheelSp:{
default:null,
type:cc.Sprite
},
maxSpeed:{
default:3,
type:cc.Float,
max:10,
min:2,
},
duration:{
default:3,
type:cc.Float,
max:5,
min:1,
tooltip:"减速前旋转时间"
},
acc:{
default:0.1,
type:cc.Float,
max:0.2,
min:0.01,
tooltip:"加速度"
},
targetID:{
default:0,
type:cc.Integer,
max:17,
min:0,
tooltip:"指定结束时的齿轮"
},
springback:{
default:t