【问题标题】:Add circles at the edges of wheelnav items that rotates along with it在与它一起旋转的 Wheelnav 项目的边缘添加圆圈
【发布时间】:2017-09-06 12:36:52
【问题描述】:

这是一个 jsFiddle 链接:

https://jsfiddle.net/zv3mb0wp/

var wheel = new wheelnav("divWheel");
  wheel.cssMode = true;
  wheel.wheelRadius = wheel.wheelRadius * 0.9;
  wheel.titleRotateAngle = 90;
  wheel.animatetime = 500;
  wheel.animateeffect = 'linear';
  wheel.spreaderEnable = true;
  wheel.spreaderRadius = 80;
  wheel.spreaderInTitle = "content"
  wheel.spreaderOutTitle = "content"
  wheel.spreaderTitleFont = "500 14px Impact, Charcoal, sans-serif";

  wheel.sliceTransformFunction  = sliceTransform().MoveMiddleTransform;

  var arr = ["Content","Content","Content","Content","Content","Content","Content"];

  wheel.createWheel(arr);

我正在努力实现以下目标:

任何关于如何做到这一点的想法将不胜感激,如果有其他方法可用,请赐教。

【问题讨论】:

    标签: javascript jquery css wheelnav.js


    【解决方案1】:

    您必须为 Wheelnav 创建一个自定义 slicePath

    var CircleEdgeSlice = function (helper, percent, custom) {
    
        var custom = new slicePathCustomization();
        custom.titleRadiusPercent = 0.7;
        helper.setBaseValue(percent, custom);
    
        slicePathString = [];
    
        slicePathString.push(helper.MoveToCenter());
        slicePathString.push(helper.LineTo(helper.startAngle+5, helper.sliceRadius));
        slicePathString.push(helper.ArcTo(helper.sliceRadius, helper.middleAngle-10, helper.sliceRadius));
        slicePathString.push(helper.ArcTo(30, helper.middleAngle+10, helper.sliceRadius));
        slicePathString.push(helper.ArcTo(helper.sliceRadius, helper.endAngle-5, helper.sliceRadius));
        slicePathString.push(helper.Close());
    
        return {
            slicePathString: slicePathString,
            linePathString: "",
            titlePosX: helper.titlePosX,
            titlePosY: helper.titlePosY
        };
    };
    

    然后在你的初始化中使用它:

    wheel.slicePathFunction = CircleEdgeSlice;
    

    这是一个修改后的JSFiddle,它产生了这个:

    【讨论】:

    • 谢谢,我希望中间圆圈和其余内容之间有一些间距,但这应该足以让我自己动手实现它:)
    猜你喜欢
    • 1970-01-01
    • 2019-04-25
    • 2012-05-13
    • 1970-01-01
    • 2021-07-30
    • 2013-12-30
    • 1970-01-01
    • 2021-11-11
    • 2020-05-22
    相关资源
    最近更新 更多