【发布时间】:2021-11-17 11:48:17
【问题描述】:
我一直在寻找一种解决方案,可以绘制戒指并使每个戒指都具有不同的色调。
结果是我想要的......但我不知道它为什么会起作用。我希望每个戒指都具有相同的颜色。
???
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
template: `
<svg [attr.height]="dimension" [attr.width]="dimension" [attr.viewBox]="'-' + dimension + ' -' + dimension + ' ' + dimension * 2 + ' ' + dimension * 2">
<circle [attr.cx]="0" [attr.cy]="0" [attr.r]="dimension" [attr.fill]="foo()"><title>{{ foo () }}</title></circle>
<circle [attr.cx]="0" [attr.cy]="0" [attr.r]="dimension/100*50" [attr.fill]="foo ()"><title>{{ foo () }}</title></circle>
<circle [attr.cx]="0" [attr.cy]="0" [attr.r]="dimension/100*10" [attr.fill]="foo ()"><title>{{ foo () }}</title></circle>
</svg>
`
})
export class AppComponent
{
dimension : number = 500;
foo ()
{
return "#" + 0xBBAABB;
}
}
【问题讨论】: