Coder Social home page Coder Social logo

旋转减速问题 about lucky-canvas HOT 7 CLOSED

buuing avatar buuing commented on May 15, 2024
旋转减速问题

from lucky-canvas.

Comments (7)

buuing avatar buuing commented on May 15, 2024

我想让 旋转减速 慢慢减速 那种效果 怎么设置

现在不就是慢慢减速吗, 如果你想让他更慢一些, 可以试着调减速时间, 具体参数请浏览文档 > defaultConfig
如果用着顺手可以点个 star 支持一下

from lucky-canvas.

xuyifeng3610 avatar xuyifeng3610 commented on May 15, 2024

想让 缓慢减速时间延长 且越来越慢 最终停止的那种 defaultConfig里面的属性设置了 感觉效果没变化

from lucky-canvas.

buuing avatar buuing commented on May 15, 2024

想让 缓慢减速时间延长 且越来越慢 最终停止的那种 defaultConfig里面的属性设置了 感觉效果没变化

你先说一下你用的哪个版本, 旋转速度相关属性是v3.2.1新增的, 然后贴一下代码我看看怎么用的

from lucky-canvas.

xuyifeng3610 avatar xuyifeng3610 commented on May 15, 2024

v3.2.1
data () {
return {
prizes: [],
defaultStyle: {
fontColor: '#d64737',
fontSize: '14px'
},
blocks: [
{ padding: '13px', background: '#d64737' }
],
buttons: [
{ radius: '50px', background: '#d64737' },
{ radius: '45px', background: '#fff' },
{ radius: '41px', background: '#f6c66f', pointer: true },
{ radius: '35px', background: '#ffdea0', fonts: [{ text: '开始\n抽奖', width: '65%', top: '-50%' }] }
],
defaultConfig: {
speed: 30,
accelerationTime: 1000,
decelerationTime: 14000,
offsetDegree: 90
}
}
},
mounted () {
this.getPrizesList()
},
methods: {
getPrizesList () {
this.prizes = []
const data = ['1元红包', '100元红包', '0.5元红包', '2元红包', '10元红包', '50元红包', '0.3元红包', '5元红包']
data.forEach((item, index) => {
this.prizes.push({
title: item,
background: index % 2 ? '#f9e3bb' : '#f8d384',
fonts: [{ text: item, top: '10%' }],
imgs: [{ src: require(../../assets/choujiang/${index}.png), width: '30%', top: '35%' }]
})
})
},
startCallBack () {
this.$refs.LuckyWheel.play()
setTimeout(() => {
this.$refs.LuckyWheel.stop(Math.random() * 8 >> 0)
}, 5000)

from lucky-canvas.

buuing avatar buuing commented on May 15, 2024

我测过了, 没什么问题, 唯一的问题就是你这个减速时间太长了, 建议1000 ~ 5000毫秒

from lucky-canvas.

buuing avatar buuing commented on May 15, 2024

如果你的意思是减速函数不够缓慢的话, 后期我会开放自定义减速函数

from lucky-canvas.

buuing avatar buuing commented on May 15, 2024

又或者你有更好的缓动函数也可以提供给我

from lucky-canvas.

Related Issues (20)

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.