-
When I use ScriptBuilder to provide visibility for elements, I find that if the start visibility is 0 and the end visibility is less than 20, the element will be displayed first and then executed according to the preset timeline. If the end visibility is greater than or equal to 20, this situation will not occur "@itwin/core-bentley": "3.7.5" const onPercentChange = (per: number) => {
const startTime = Date.parse('2022/06/26') / 1000
const endTime = Date.parse('2022/06/27') / 1000
vp.timePoint = (startTime + (endTime - startTime) * per * 0.01)
// console.log(vp.timePoint)
}
const InsertVisibilityScript = () => {
const scriptBuilder = new RenderSchedule.ScriptBuilder()
const modelBuilder = scriptBuilder.addModelTimeline('0x2000000000f')
const elementBuilder = modelBuilder.addElementTimeline([ '0x20000000141' ])
const startTime = Date.parse('2022/06/26') / 1000
const endTime = Date.parse('2022/06/28') / 1000
elementBuilder.addVisibility(startTime, 0)
// elementBuilder.addVisibility(endTime, 10)
// elementBuilder.addVisibility(endTime, 19.6)
elementBuilder.addVisibility(endTime, 20)
elementBuilder.addColor(endTime, new RgbColor(255, 0, 0))
const scriptProps = scriptBuilder.finish()
console.log(scriptProps)
vp.view.displayStyle.scheduleScript = RenderSchedule.Script.fromJSON(scriptProps)
} Video_2024-11-07_135458.mp4 |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Hi, @peiyanlu. Thank you for reporting this issue. To summarize from your video: if the end visibility is less than 20, then at 1% along the timeline the element appears fully opaque instead of almost entirely transparent. Does that about sum it up? I am trying and failing to reproduce the issue in a unit test in #7342. I feel I may be missing some crucial detail. |
Beta Was this translation helpful? Give feedback.
-
Yes, there is no problem with what you described. I haven't found out what caused this problem yet, so I have created a demo hoping it will be helpful to you https://github.com/peiyanlu/itwin-v3.7.5-demo |
Beta Was this translation helpful? Give feedback.
-
Hi @peiyanlu, I was unable to reproduce this in my unit tests and display-test-app because I'm using a much newer version of iTwin.js than you are. You are using 3.7.5. I updated your demo app to iTwin.js 4.10.0 and confirmed the transparency interpolates smoothly. I did have to add an option to your call to await IModelApp.startup({
tileAdmin: {
cacheTileMetadata: true,
enableFrontendScheduleScripts: true,
generateAllPolyfaceEdges: false,
decodeImdlInWorker: false, // <-- ADDED THIS
}, iTwin.js 3.x entered end of life 6 months ago. Please update to get this bug fix. |
Beta Was this translation helpful? Give feedback.
Hi @peiyanlu,
I was unable to reproduce this in my unit tests and display-test-app because I'm using a much newer version of iTwin.js than you are. You are using 3.7.5.
I updated your demo app to iTwin.js 4.10.0 and confirmed the transparency interpolates smoothly. I did have to add an option to your call to
IModelApp.startup
because your app isn't set up to serve an otherwise-needed worker script. Without that change the iModel would fail to display.iTwin.js 3.x …