kaki Posted June 8, 2023 Share Posted June 8, 2023 Hello, I'm trying to make a simple animation that I've seen in some examples on the forum: I use the following instruction UniSession.AddJS(UniPanel1.JSName + '.el.fadeIn({duration: 1000})'); but it doesn't work for me, I get the following error: Cannot read properties of undefined (reading 'fadeIn') Thank, Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 8, 2023 Share Posted June 8, 2023 20 minutes ago, kaki said: UniSession.AddJS(UniPanel1.JSName + '.el.fadeIn({duration: 1000})'); Hello, Where are you using? Quote Link to comment Share on other sites More sharing options...
kaki Posted June 8, 2023 Author Share Posted June 8, 2023 Unigui version 1.90.0.1564 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 8, 2023 Share Posted June 8, 2023 1 minute ago, kaki said: Unigui version 1.90.0.1564 Okay, thx. In which place are you using above code? Quote Link to comment Share on other sites More sharing options...
kaki Posted June 8, 2023 Author Share Posted June 8, 2023 with TUniPanel.Create(self) do begin Name:='test_sss'; Parent:=panelPadre; Caption:='Test label'; UniSession.AddJS(JSName + '.el.fadeIn({duration: 1000})'); end; It's just an example where I create a dashboard at runtime. I have captured it from forum examples Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 8, 2023 Share Posted June 8, 2023 6 minutes ago, kaki said: with TUniPanel.Create(self) do begin Name:='test_sss'; Parent:=panelPadre; Caption:='Test label'; UniSession.AddJS(JSName + '.el.fadeIn({duration: 1000})'); end; Where are you using these codes? In my case, let's say in the button click handler, this code works, at least without an error. Quote Link to comment Share on other sites More sharing options...
kaki Posted June 8, 2023 Author Share Posted June 8, 2023 The piece of code is part of a procedure. If I write it in the click event of a TuniButton it works, but at the same time it creates the panel without animation. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 8, 2023 Share Posted June 8, 2023 That's why it's not clear to me exactly where you are getting the error. 2 minutes ago, kaki said: but at the same time it creates the panel without animation. But I guess that's another case... Quote Link to comment Share on other sites More sharing options...
kaki Posted June 8, 2023 Author Share Posted June 8, 2023 Well, I'll explain: I create panels at runtime, and I need to possibly have the diffusion effect, as I have read on this forum about fadeIn and fadeOut. Quote Link to comment Share on other sites More sharing options...
kaki Posted June 8, 2023 Author Share Posted June 8, 2023 procedure TFCompras_Dashboard.UniButton1Click(Sender: TObject); begin with TUniPanel.Create(self) do begin Name:='test_sss'; Parent:=panelPadre; Caption:='Test label'; JSInterface.JSConfig('style', [JSControl.JSObject('opacity: 0')]); JSInterface.JSCall('getEl().fadeIn', [JSControl.JSObject('duration: 1500')]); end; end; With this code it works perfect! but you would have to do it from a procedure, without clicking a button. I'm going to try using some event of the frame 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.