gpt4 book ai didi

javascript - 从组 paperJS 中删除特定的子组

转载 作者:行者123 更新时间:2023-12-02 18:39:28 25 4
gpt4 key购买 nike

如何从组中仅删除特定的 child 。这是我的代码。谁能帮忙。

    <script type="text/paperscript" canvas="canvas">

var path = new Path.Circle(new Point(80, 50), 35);
var secondPath = new Path.Circle(new Point(180, 50), 35);


var group = new Group();

group.addChild(path);
group.addChild(secondPath);


group.fillColor = 'green';


group.removeChildren();
</script>

如何删除路径或第二路径。

最佳答案

只需为路径命名:http://paperjs.org/reference/path

var path = new Path.Circle({
center: [80, 50],
radius: 35
});
// Set the name of the path:
path.name = 'example';

// Create a group and add path to it as a child:
var group = new Group();
group.addChild(path);

// The path can be accessed by name:
group.children['example'].fillColor = 'red';

关于javascript - 从组 paperJS 中删除特定的子组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16977252/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com