View unanswered posts | View active topics It is currently 2020-08-09 11:07



Reply to topic  [ 6 posts ] 
 网元的image从image1(带动画效果)替换为image2(非动画),会出现image1留下的轨迹 
Author Message
新手上路

Joined: 2020-01-08 17:05
Posts: 7
Post 网元的image从image1(带动画效果)替换为image2(非动画),会出现image1留下的轨迹
如题,我给网元注册了个动画效果的image1和非动画效果image2,当我设置node.setImage(image1)变换为node.setImage(image2)时,
现象:
1.虽然替换了image2但画布留下了image1部分轨迹,难道画图并未刷新好?。注册图片的clip我也设置成了true。
2.目前发现当鼠标离开当前画布区域,污染轨迹会立马消失,很神奇。

求老师赐教该如何解决这个污染轨迹。。。不胜感激


2020-01-09 20:52
Profile
TWaver开发组
User avatar

Joined: 2019-04-23 11:02
Posts: 88
Post Re: 网元的image从image1(带动画效果)替换为image2(非动画),会出现image1留下的轨迹
是用代码注册的动态图片吗,我没发现这个问题,方便发一个demo测试一下吗


2020-01-10 13:43
Profile
新手上路

Joined: 2020-01-08 17:05
Posts: 7
Post Re: 网元的image从image1(带动画效果)替换为image2(非动画),会出现image1留下的轨迹
skm_mks wrote:
是用代码注册的动态图片吗,我没发现这个问题,方便发一个demo测试一下吗


//*****hi,您好,鉴于我司保密性,给您一下我注册的两个图片,一个带动画效果,一个不带
Code:

//图片1
twaver.Util.registerImage('node_image', {
"w": 40,
"h": 40,
"clip": true,
"padding":"15px",
"origin": {
"x": 0,
"y": 0
},
"translate": {
"x": 0,
"y": 0
},
"v": [
{
"shape": "path",
"data": "M38,40H2c-1.105,0-2-0.895-2-2V2c0-1.105,0.895-2,2-2h36c1.105,0,2,0.895,2,2v36C40,39.105,39.105,40,38,40z ",
"fill": "#2F95FF"
},{
"shape": "g",
"v": [
{
"shape": "path",
"data": "M11.17,17.631c-0.514-0.491-1.329-0.472-1.82,0.042c-0.473,0.496-0.475,1.275-0.004,1.773l4.694,4.694 l-4.774,4.775v-3.443c0-0.711-0.576-1.287-1.287-1.287s-1.287,0.576-1.287,1.287v6.549c0,0.711,0.576,1.287,1.287,1.287h6.549 c0.711,0.02,1.303-0.54,1.322-1.251c0.02-0.711-0.54-1.303-1.251-1.322c-0.024-0.001-0.048-0.001-0.072,0h-3.442l5.684-5.684 c0.503-0.503,0.503-1.317,0-1.82L11.17,17.631z",
"fill": "#FFFFFF"
},
{
"shape": "path",
"data": "M7.978,15.815c0.711,0,1.287-0.575,1.288-1.286c0,0,0-0.001,0-0.002v-3.442l5.684,5.684 c0.503,0.503,1.317,0.503,1.82,0l5.6-5.6c0.499-0.506,0.492-1.321-0.014-1.82c-0.499-0.492-1.301-0.494-1.802-0.004v0.001 L15.86,14.04l-4.774-4.775h3.443c0.711,0,1.287-0.576,1.287-1.287c0-0.711-0.576-1.287-1.287-1.287c0,0,0,0,0,0h-6.55 c-0.711,0-1.287,0.576-1.287,1.287v6.549C6.691,15.238,7.267,15.815,7.978,15.815z",
"fill": "#FFFFFF"
},
{
"shape": "path",
"data": "M32.022,6.691h-6.55c-0.711,0-1.287,0.577-1.286,1.288c0,0.71,0.576,1.286,1.286,1.286h3.443l-5.684,5.684 c-0.503,0.503-0.503,1.317,0,1.82l5.6,5.6c0.514,0.491,1.329,0.472,1.82-0.042c0.473-0.496,0.475-1.275,0.004-1.773l-4.694-4.695 l4.774-4.774v3.443c0,0.711,0.575,1.287,1.286,1.288c0.711,0,1.287-0.575,1.288-1.286c0,0,0-0.001,0-0.002v-6.55 C33.309,7.267,32.732,6.691,32.022,6.691z",
"fill": "#FFFFFF"
},
{
"shape": "path",
"data": "M32.021,24.186c-0.71,0-1.286,0.576-1.286,1.286v3.443l-5.684-5.684c-0.503-0.503-1.317-0.503-1.82,0 l-5.6,5.6c-0.491,0.514-0.471,1.329,0.043,1.82c0.496,0.473,1.275,0.475,1.773,0.003l4.694-4.694l4.774,4.774h-3.443 c-0.711,0.02-1.27,0.612-1.251,1.322c0.019,0.683,0.568,1.232,1.251,1.251h6.55c0.711,0,1.287-0.576,1.287-1.287v-6.548 C33.308,24.761,32.732,24.186,32.021,24.186z",
"fill": "#FFFFFF"
}
]
}
]
});

//**图片2
twaver.Util.registerImage('click_topo_node', {
w: 40,
h: 40,
v: [
{
shape: 'circle',
r: 25,
alpha: 1,
fill: '#f5f5f5',
},
{
shape: 'circle',
cx: 0,
cy: 0,
r: 20,
lineColor: '#44D4FF',
fill: '#44D4FF',
alpha: 0.2,
gradient: 'radial.center',
animate: [{
attr: 'r',
to: 35,
dur: 1000,
reverse: true,
repeat: Number.POSITIVE_INFINITY
},{
attr: 'alpha',
to: 0.5,
dur: 1000,
reverse: true,
repeat: Number.POSITIVE_INFINITY
}]
},

{
shape: "vector",
name: "node_image"
}
]
});



比如说你点击某个网元前,网元图片是图片1,点击后是带动画图片2,再点击视图背景后再次设置为图1。当图2动画圆到达最大时去变换图片就会出现上述现象,多点几次必现


2020-01-10 14:56
Profile
TWaver开发组
User avatar

Joined: 2017-02-22 10:01
Posts: 424
Post Re: 网元的image从image1(带动画效果)替换为image2(非动画),会出现image1留下的轨迹
把图片2种的w和h改成70试试


2020-01-10 16:21
Profile
新手上路

Joined: 2020-01-08 17:05
Posts: 7
Post Re: 网元的image从image1(带动画效果)替换为image2(非动画),会出现image1留下的轨迹
Paddy wrote:
把图片2种的w和h改成70试试


您好,我的拓扑里node和node之间会有箭头->方向 我wh设置成40目的是让外形就在40X40的区域,这样箭头就在40X40的表面。
1.如果改成70X70 箭头->终点就会落在70X70的表面,偏离了位置 这样就不符合当前设计
2.我之前考虑过设置箭头偏离距离,但是目前API好像只能设置arrow横向或者纵向偏移距离,如果两节点之间的箭线以不确定角度比如说45度,设置横向纵向偏移距离就不合适了


2020-01-10 16:58
Profile
TWaver开发组
User avatar

Joined: 2017-02-22 10:01
Posts: 424
Post Re: 网元的image从image1(带动画效果)替换为image2(非动画),会出现image1留下的轨迹
是因为你里面动画的半径都35了,如果一定要用40就要把里面的circle半径改小,还有引用的node_image图片的w和h也要改小,也就是说动画的最外层不能超过40*40这个范围。


2020-01-10 17:46
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron