在这里,我试图在蜘蛛/雷达图上实现雷达效果。理想情况下,我希望在给定的时间(例如,在30秒内绘制的线消失为透明的,我正在考虑更改顺序颜色图或绘制的线条被删除/清除),但这可能会导致问题。因此,如果绘制的线过渡/淡入透明将允许较少的杂乱的整体图。这是可能的,但对我来说却很棘手。
set grid ls 10
set xtics axis format "" scale 0
set ytics axis format ""
set size square
set style line 9 lt 1 lw 2 pt 2 ps 2
set multiplot layout 1,2
plot 'somedata' using 1:5 t "" w lp ls 9
unset multiplot
pause 90
replot我怎么能在小阴谋中做到这一点呢?在我的阅读中,我读到了一些叫做Lerp/ Lerping颜色的东西,但是我并没有使用Csharp或Unity。
显示需要淡出/清除的标记的输出。主要的区别是只有1,而不是9。
发布于 2021-03-30 19:52:59
从你的描述中,我仍然不清楚你的期望是什么。因此,这是一个我认为“雷达效应”的例子,即褪色。它在which循环(check help while)中设置透明颜色,您可以通过按x (check help bind)来停止。当然可以对代码进行进一步优化,但我希望您能够根据您的需要对其进行调整。
代码:
### attempt to mimic a radar screen
reset session
# create some test landscape
set xrange [-8:8]
set yrange [-8:8]
set samples 50
set isosamples 50
set contour
set cntrparam level 5
set table $Data
splot (sin(1.3*x)*cos(.9*y)+cos(.8*x)*sin(1.9*y)+cos(y*.2*x))*3
unset table
unset contour
set angle degrees
Angle(dx,dy) = dx==dx && dy==dy ? dx==0 ? dy==0 ? NaN : \
abs(sgn(dy))*180-sgn(dy)*90 : dx<0 ? 180+atan(dy/dx) : \
dy<0 ? atan(dy/dx)+360 : atan(dy/dx) : NaN
r(x,y) = sqrt(x**2 + y**2)
set table $Contour
plot $Data u (Angle($1,$2)):(r($1,$2)) index 1::1
unset table
set size ratio 1
set polar
unset border
set border polar lc "green"
unset xtics
unset ytics
set format r ""
unset raxis
set rtics scale 0
set format t ""
set grid lw 2 lc "green"
set obj 1 rect from screen 0,0 to screen 1,1 fc "black" behind # black background
stop = 0
bind x "stop=1"
$Data <<EOD
45 5
0 4
123 3.5
325 3.5
EOD
unset key
set trange [0:360]
set rrange [0:8]
alpha(a,a0) = int((1-exp(-real(a)/a0))*255)<<24 # transparency "decay"
myBaseColor = 0x00ff00
myColorA(a) = myBaseColor + alpha(a,45) # decay for radar "beam"
AngleDiff(a,b) = b>a ? b-a : 360-a+b
myColorB(a,b) = myBaseColor + alpha(AngleDiff(a,b),220) # decay for data
a=90; step=5
while (!stop) {
a = a<step ? a=a+360-step : a-step
do for [i=0:180] {
set obj 100+i circle at 0,0 size 8 arc [a+i:a+i+2] fs solid noborder fc rgb myColorA(i) behind
}
plot $Data u 1:2:(myColorB(a,$1)) w p pt 7 lc rgb var, \
$Contour u 1:2:(myColorB(a,$1)) w l lc rgb var
}
### end of code结果:( ScreenToGif从wxt终端获取屏幕截图)

https://stackoverflow.com/questions/66783055
复制相似问题